librustc: tidy
This commit is contained in:
parent
601c2edb4d
commit
6282e5da67
9 changed files with 43 additions and 33 deletions
|
@ -686,7 +686,9 @@ pub fn exported_name(sess: Session,
|
|||
path_name(sess.ident_of(vers.to_owned()))));
|
||||
}
|
||||
|
||||
pub fn mangle_exported_name(ccx: @CrateContext, +path: path, t: ty::t) -> ~str {
|
||||
pub fn mangle_exported_name(ccx: @CrateContext,
|
||||
+path: path,
|
||||
t: ty::t) -> ~str {
|
||||
let hash = get_symbol_hash(ccx, t);
|
||||
return exported_name(ccx.sess, path,
|
||||
hash,
|
||||
|
|
|
@ -1071,7 +1071,8 @@ fn encode_attributes(ebml_w: writer::Encoder, attrs: &[attribute]) {
|
|||
// metadata that Rust cares about for linking crates. This attribute requires
|
||||
// 'name' and 'vers' items, so if the user didn't provide them we will throw
|
||||
// them in anyway with default values.
|
||||
fn synthesize_crate_attrs(ecx: @EncodeContext, crate: &crate) -> ~[attribute] {
|
||||
fn synthesize_crate_attrs(ecx: @EncodeContext,
|
||||
crate: &crate) -> ~[attribute] {
|
||||
|
||||
fn synthesize_link_attr(ecx: @EncodeContext, +items: ~[@meta_item]) ->
|
||||
attribute {
|
||||
|
|
|
@ -565,7 +565,8 @@ fn encode_method_map_entry(ecx: @e::EncodeContext,
|
|||
}
|
||||
|
||||
impl read_method_map_entry_helper for reader::Decoder {
|
||||
fn read_method_map_entry(xcx: @ExtendedDecodeContext) -> method_map_entry {
|
||||
fn read_method_map_entry(xcx: @ExtendedDecodeContext)
|
||||
-> method_map_entry {
|
||||
do self.read_rec {
|
||||
method_map_entry {
|
||||
self_arg: self.read_field(~"self_arg", 0u, || {
|
||||
|
@ -672,7 +673,8 @@ fn encode_vtable_origin(ecx: @e::EncodeContext,
|
|||
|
||||
trait vtable_decoder_helpers {
|
||||
fn read_vtable_res(xcx: @ExtendedDecodeContext) -> typeck::vtable_res;
|
||||
fn read_vtable_origin(xcx: @ExtendedDecodeContext) -> typeck::vtable_origin;
|
||||
fn read_vtable_origin(xcx: @ExtendedDecodeContext)
|
||||
-> typeck::vtable_origin;
|
||||
}
|
||||
|
||||
impl vtable_decoder_helpers for reader::Decoder {
|
||||
|
|
|
@ -130,42 +130,42 @@ pub fn get_lint_dict() -> LintDict {
|
|||
|
||||
(@~"unused_imports",
|
||||
@LintSpec {
|
||||
lint: unused_imports,
|
||||
lint: unused_imports,
|
||||
desc: "imports that are never used",
|
||||
default: allow
|
||||
}),
|
||||
|
||||
(@~"while_true",
|
||||
@LintSpec {
|
||||
lint: while_true,
|
||||
lint: while_true,
|
||||
desc: "suggest using loop { } instead of while(true) { }",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"path_statement",
|
||||
@LintSpec {
|
||||
lint: path_statement,
|
||||
lint: path_statement,
|
||||
desc: "path statements with no effect",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"unrecognized_lint",
|
||||
@LintSpec {
|
||||
lint: unrecognized_lint,
|
||||
lint: unrecognized_lint,
|
||||
desc: "unrecognized lint attribute",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"non_implicitly_copyable_typarams",
|
||||
@LintSpec {
|
||||
lint: non_implicitly_copyable_typarams,
|
||||
lint: non_implicitly_copyable_typarams,
|
||||
desc: "passing non implicitly copyable types as copy type params",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"vecs_implicitly_copyable",
|
||||
@LintSpec {
|
||||
lint: vecs_implicitly_copyable,
|
||||
lint: vecs_implicitly_copyable,
|
||||
desc: "make vecs and strs not implicitly copyable \
|
||||
(only checked at top level)",
|
||||
default: warn
|
||||
|
@ -173,84 +173,84 @@ pub fn get_lint_dict() -> LintDict {
|
|||
|
||||
(@~"implicit_copies",
|
||||
@LintSpec {
|
||||
lint: implicit_copies,
|
||||
lint: implicit_copies,
|
||||
desc: "implicit copies of non implicitly copyable data",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"deprecated_mode",
|
||||
@LintSpec {
|
||||
lint: deprecated_mode,
|
||||
lint: deprecated_mode,
|
||||
desc: "warn about deprecated uses of modes",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"deprecated_pattern",
|
||||
@LintSpec {
|
||||
lint: deprecated_pattern,
|
||||
lint: deprecated_pattern,
|
||||
desc: "warn about deprecated uses of pattern bindings",
|
||||
default: allow
|
||||
}),
|
||||
|
||||
(@~"non_camel_case_types",
|
||||
@LintSpec {
|
||||
lint: non_camel_case_types,
|
||||
lint: non_camel_case_types,
|
||||
desc: "types, variants and traits should have camel case names",
|
||||
default: allow
|
||||
}),
|
||||
|
||||
(@~"managed_heap_memory",
|
||||
@LintSpec {
|
||||
lint: managed_heap_memory,
|
||||
lint: managed_heap_memory,
|
||||
desc: "use of managed (@ type) heap memory",
|
||||
default: allow
|
||||
}),
|
||||
|
||||
(@~"owned_heap_memory",
|
||||
@LintSpec {
|
||||
lint: owned_heap_memory,
|
||||
lint: owned_heap_memory,
|
||||
desc: "use of owned (~ type) heap memory",
|
||||
default: allow
|
||||
}),
|
||||
|
||||
(@~"heap_memory",
|
||||
@LintSpec {
|
||||
lint: heap_memory,
|
||||
lint: heap_memory,
|
||||
desc: "use of any (~ type or @ type) heap memory",
|
||||
default: allow
|
||||
}),
|
||||
|
||||
(@~"structural_records",
|
||||
@LintSpec {
|
||||
lint: structural_records,
|
||||
lint: structural_records,
|
||||
desc: "use of any structural records",
|
||||
default: deny
|
||||
}),
|
||||
|
||||
(@~"legacy modes",
|
||||
@LintSpec {
|
||||
lint: legacy_modes,
|
||||
lint: legacy_modes,
|
||||
desc: "allow legacy modes",
|
||||
default: forbid
|
||||
}),
|
||||
|
||||
(@~"type_limits",
|
||||
@LintSpec {
|
||||
lint: type_limits,
|
||||
lint: type_limits,
|
||||
desc: "comparisons made useless by limits of the types involved",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"default_methods",
|
||||
@LintSpec {
|
||||
lint: default_methods,
|
||||
lint: default_methods,
|
||||
desc: "allow default methods",
|
||||
default: deny
|
||||
}),
|
||||
|
||||
(@~"deprecated_self",
|
||||
@LintSpec {
|
||||
lint: deprecated_self,
|
||||
lint: deprecated_self,
|
||||
desc: "warn about deprecated uses of `self`",
|
||||
default: warn
|
||||
}),
|
||||
|
@ -258,14 +258,14 @@ pub fn get_lint_dict() -> LintDict {
|
|||
/* FIXME(#3266)--make liveness warnings lintable
|
||||
(@~"unused_variable",
|
||||
@LintSpec {
|
||||
lint: unused_variable,
|
||||
lint: unused_variable,
|
||||
desc: "detect variables which are not used in any way",
|
||||
default: warn
|
||||
}),
|
||||
|
||||
(@~"dead_assignment",
|
||||
@LintSpec {
|
||||
lint: dead_assignment,
|
||||
lint: dead_assignment,
|
||||
desc: "detect assignments that will never be read",
|
||||
default: warn
|
||||
}),
|
||||
|
|
|
@ -479,7 +479,9 @@ pub fn get_res_dtor(ccx: @CrateContext, did: ast::def_id,
|
|||
inline::maybe_instantiate_inline(ccx, did, true)
|
||||
} else { did };
|
||||
assert did.crate == ast::local_crate;
|
||||
let (val, _) = monomorphize::monomorphic_fn(ccx, did, substs, None, None, None);
|
||||
let (val, _) =
|
||||
monomorphize::monomorphic_fn(ccx, did, substs, None, None, None);
|
||||
|
||||
val
|
||||
} else if did.crate == ast::local_crate {
|
||||
get_item_val(ccx, did.node)
|
||||
|
@ -2206,7 +2208,8 @@ pub fn is_main_fn(sess: &Session, node_id: ast::node_id) -> bool {
|
|||
|
||||
// Create a _rust_main(args: ~[str]) function which will be called from the
|
||||
// runtime rust_start function
|
||||
pub fn create_main_wrapper(ccx: @CrateContext, _sp: span, main_llfn: ValueRef) {
|
||||
pub fn create_main_wrapper(ccx: @CrateContext,
|
||||
_sp: span, main_llfn: ValueRef) {
|
||||
|
||||
let llfn = create_main(ccx, main_llfn);
|
||||
create_entry_fn(ccx, llfn);
|
||||
|
@ -2911,7 +2914,8 @@ pub fn fill_crate_map(ccx: @CrateContext, map: ValueRef) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn crate_ctxt_to_encode_parms(cx: @CrateContext) -> encoder::EncodeParams {
|
||||
pub fn crate_ctxt_to_encode_parms(cx: @CrateContext)
|
||||
-> encoder::EncodeParams {
|
||||
let encode_inlined_item: encoder::encode_inlined_item =
|
||||
|ecx, ebml_w, path, ii|
|
||||
astencode::encode_inlined_item(ecx, ebml_w, path, ii, cx.maps);
|
||||
|
|
|
@ -261,7 +261,8 @@ fn get_file_path_and_dir(work_dir: &str, full_path: &str) -> (~str, ~str) {
|
|||
}, str::from_slice(work_dir))
|
||||
}
|
||||
|
||||
fn create_file(cx: @CrateContext, +full_path: ~str) -> @Metadata<FileMetadata> {
|
||||
fn create_file(cx: @CrateContext, +full_path: ~str)
|
||||
-> @Metadata<FileMetadata> {
|
||||
let cache = get_cache(cx);;
|
||||
let tg = FileDescriptorTag;
|
||||
match cached_metadata::<@Metadata<FileMetadata>>(
|
||||
|
|
Loading…
Reference in a new issue