Skip to content

Commit e99da52

Browse files
nrcnikomatsakis
authored andcommitted
satisfy make tidy
1 parent 1fee416 commit e99da52

File tree

29 files changed

+114
-64
lines changed

29 files changed

+114
-64
lines changed

src/libcore/array.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ macro_rules! array_impls {
5757
Rhs: Deref<Target=[B]>,
5858
{
5959
#[inline(always)]
60-
fn eq(&self, other: &Rhs) -> bool { PartialEq::eq(self.index(&FullRange), &**other) }
60+
fn eq(&self, other: &Rhs) -> bool {
61+
PartialEq::eq(self.index(&FullRange), &**other)
62+
}
6163
#[inline(always)]
62-
fn ne(&self, other: &Rhs) -> bool { PartialEq::ne(self.index(&FullRange), &**other) }
64+
fn ne(&self, other: &Rhs) -> bool {
65+
PartialEq::ne(self.index(&FullRange), &**other)
66+
}
6367
}
6468

6569
#[stable]
@@ -68,9 +72,13 @@ macro_rules! array_impls {
6872
Lhs: Deref<Target=[A]>
6973
{
7074
#[inline(always)]
71-
fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other.index(&FullRange)) }
75+
fn eq(&self, other: &[B; $N]) -> bool {
76+
PartialEq::eq(&**self, other.index(&FullRange))
77+
}
7278
#[inline(always)]
73-
fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other.index(&FullRange)) }
79+
fn ne(&self, other: &[B; $N]) -> bool {
80+
PartialEq::ne(&**self, other.index(&FullRange))
81+
}
7482
}
7583

7684
#[stable]

src/librustc/lint/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
492492
None => {
493493
self.span_lint(builtin::UNKNOWN_LINTS, span,
494494
format!("unknown `{}` attribute: `{}`",
495-
level.as_str(), lint_name).index(&FullRange));
495+
level.as_str(), lint_name).as_slice());
496496
continue;
497497
}
498498
}
@@ -784,7 +784,7 @@ pub fn check_crate(tcx: &ty::ctxt,
784784
for &(lint, span, ref msg) in v.iter() {
785785
tcx.sess.span_bug(span,
786786
format!("unprocessed lint {} at {}: {}",
787-
lint.as_str(), tcx.map.node_to_string(*id), *msg).index(&FullRange))
787+
lint.as_str(), tcx.map.node_to_string(*id), *msg).as_slice())
788788
}
789789
}
790790

src/librustc/metadata/loader.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,8 @@ impl<'a> Context<'a> {
624624
return true
625625
} else {
626626
let (ref prefix, ref suffix) = dylibname;
627-
if file.starts_with(prefix.index(&FullRange)) && file.ends_with(suffix.index(&FullRange)) {
627+
if file.starts_with(prefix.index(&FullRange)) &&
628+
file.ends_with(suffix.index(&FullRange)) {
628629
return true
629630
}
630631
}

src/librustc/middle/cfg/graphviz.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ impl<'a, 'ast> dot::Labeller<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast> {
8585
let s = self.ast_map.node_to_string(node_id);
8686
// left-aligns the lines
8787
let s = replace_newline_with_backslash_l(s);
88-
label.push_str(format!("exiting scope_{} {}", i, s.index(&FullRange)).index(&FullRange));
88+
label.push_str(format!("exiting scope_{} {}",
89+
i,
90+
s.index(&FullRange)).index(&FullRange));
8991
}
9092
dot::LabelText::EscStr(label.into_cow())
9193
}

src/librustc/session/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
639639
let target = match Target::search(opts.target_triple.index(&FullRange)) {
640640
Ok(t) => t,
641641
Err(e) => {
642-
sp.handler().fatal((format!("Error loading target specification: {}", e)).index(&FullRange));
642+
sp.handler().fatal((format!("Error loading target specification: {}", e)).as_slice());
643643
}
644644
};
645645

src/librustc_back/target/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ impl Target {
247247
} );
248248
($key_name:ident, bool) => ( {
249249
let name = (stringify!($key_name)).replace("_", "-");
250-
obj.find(name.index(&FullRange)).map(|o| o.as_boolean().map(|s| base.options.$key_name = s));
250+
obj.find(name.index(&FullRange))
251+
.map(|o| o.as_boolean()
252+
.map(|s| base.options.$key_name = s));
251253
} );
252254
($key_name:ident, list) => ( {
253255
let name = (stringify!($key_name)).replace("_", "-");

src/librustc_borrowck/borrowck/doc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
//! - `FREEZE` means that the `LV` cannot be borrowed immutably;
139139
//!
140140
//! Finally, it is never possible to move from an lvalue that appears in a
141-
//! restriction. This implies that the "empty restriction" `(LV, .index(&FullRange))`,
141+
//! restriction. This implies that the "empty restriction" `(LV, [])`,
142142
//! which contains an empty set of actions, still has a purpose---it
143143
//! prevents moves from `LV`. I chose not to make `MOVE` a fourth kind of
144144
//! action because that would imply that sometimes moves are permitted
@@ -476,7 +476,7 @@
476476
//! ```text
477477
//! &mut LV => RESTRICTIONS(LV, LT, MUTATE|CLAIM|FREEZE)
478478
//! &LV => RESTRICTIONS(LV, LT, MUTATE|CLAIM)
479-
//! &const LV => RESTRICTIONS(LV, LT, .index(&FullRange))
479+
//! &const LV => RESTRICTIONS(LV, LT, [])
480480
//! ```
481481
//!
482482
//! The reasoning here is that a mutable borrow must be the only writer,
@@ -542,7 +542,7 @@
542542
//! restricting `MUTATE` and `CLAIM` actions:
543543
//!
544544
//! ```text
545-
//! RESTRICTIONS(*LV, LT, ACTIONS) = .index(&FullRange) // R-Deref-Imm-Borrowed
545+
//! RESTRICTIONS(*LV, LT, ACTIONS) = [] // R-Deref-Imm-Borrowed
546546
//! TYPE(LV) = &LT' Ty
547547
//! LT <= LT' // (1)
548548
//! ACTIONS subset of [MUTATE, CLAIM]
@@ -660,7 +660,7 @@
660660
//! necessary to add any restrictions at all to the final result.
661661
//!
662662
//! ```text
663-
//! RESTRICTIONS(*LV, LT, .index(&FullRange)) = .index(&FullRange) // R-Deref-Freeze-Borrowed
663+
//! RESTRICTIONS(*LV, LT, []) = [] // R-Deref-Freeze-Borrowed
664664
//! TYPE(LV) = &const Ty
665665
//! ```
666666
//!

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
820820
mc::AliasableClosure(id) => {
821821
self.tcx.sess.span_err(span,
822822
format!("{} in a captured outer \
823-
variable in an `Fn` closure", prefix).index(&FullRange));
823+
variable in an `Fn` closure", prefix).as_slice());
824824
span_help!(self.tcx.sess, self.tcx.map.span(id),
825825
"consider changing this closure to take self by mutable reference");
826826
}

src/librustc_resolve/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,13 +3757,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
37573757
self.resolve_error(path.span,
37583758
format!("`{}` is not an enum variant, struct or const",
37593759
token::get_ident(
3760-
path.segments.last().unwrap().identifier)).index(&FullRange));
3760+
path.segments.last().unwrap().identifier)).as_slice());
37613761
}
37623762
None => {
37633763
self.resolve_error(path.span,
37643764
format!("unresolved enum variant, struct or const `{}`",
37653765
token::get_ident(
3766-
path.segments.last().unwrap().identifier)).index(&FullRange));
3766+
path.segments.last().unwrap().identifier)).as_slice());
37673767
}
37683768
}
37693769

src/librustc_trans/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ fn link_rlib<'a>(sess: &'a Session,
608608
// extension to it. This is to work around a bug in LLDB that
609609
// would cause it to crash if the name of a file in an archive
610610
// was exactly 16 bytes.
611-
let bc_filename = obj_filename.with_extension(format!("{}.bc", i).index(&FullRange));
611+
let bc_filename = obj_filename.with_extension(format!("{}.bc", i).as_slice());
612612
let bc_deflated_filename = obj_filename.with_extension(
613613
format!("{}.bytecode.deflate", i).index(&FullRange));
614614

@@ -1083,8 +1083,8 @@ fn add_local_native_libraries(cmd: &mut Command, sess: &Session) {
10831083
// -force_load is the OSX equivalent of --whole-archive, but it
10841084
// involves passing the full path to the library to link.
10851085
let lib = archive::find_library(l.index(&FullRange),
1086-
sess.target.target.options.staticlib_prefix.index(&FullRange),
1087-
sess.target.target.options.staticlib_suffix.index(&FullRange),
1086+
sess.target.target.options.staticlib_prefix.as_slice(),
1087+
sess.target.target.options.staticlib_suffix.as_slice(),
10881088
search_path.index(&FullRange),
10891089
&sess.diagnostic().handler);
10901090
let mut v = b"-Wl,-force_load,".to_vec();

src/librustc_trans/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
6464
debug!("reading {}", file);
6565
for i in iter::count(0u, 1) {
6666
let bc_encoded = time(sess.time_passes(),
67-
format!("check for {}.{}.bytecode.deflate", name, i).index(&FullRange),
67+
format!("check for {}.{}.bytecode.deflate", name, i).as_slice(),
6868
(),
6969
|_| {
7070
archive.read(format!("{}.{}.bytecode.deflate",

src/librustc_trans/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ unsafe extern "C" fn diagnostic_handler(info: DiagnosticInfoRef, user: *mut c_vo
383383
cgcx.handler.note(format!("optimization {} for {} at {}: {}",
384384
opt.kind.describe(),
385385
pass_name,
386-
if loc.is_empty() { "[unknown]" } else { loc.index(&FullRange) },
387-
llvm::twine_to_string(opt.message)).index(&FullRange));
386+
if loc.is_empty() { "[unknown]" } else { loc.as_slice() },
387+
llvm::twine_to_string(opt.message)).as_slice());
388388
}
389389
}
390390

src/librustc_trans/save/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
292292
Some(def_id) => {
293293
result.push_str(" as ");
294294
result.push_str(
295-
ty::item_path_str(&self.analysis.ty_cx, def_id).index(&FullRange));
295+
ty::item_path_str(&self.analysis.ty_cx, def_id).as_slice());
296296
},
297297
None => {}
298298
}
@@ -636,7 +636,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
636636
item.id);
637637

638638
for field in struct_def.fields.iter() {
639-
self.process_struct_field_def(field, qualname.index(&FullRange), variant.node.id);
639+
self.process_struct_field_def(field, qualname.as_slice(), variant.node.id);
640640
self.visit_ty(&*field.node.ty);
641641
}
642642
}
@@ -774,7 +774,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
774774
let def_map = self.analysis.ty_cx.def_map.borrow();
775775
if !def_map.contains_key(&id) {
776776
self.sess.span_bug(span,
777-
format!("def_map has no key for {} in visit_expr", id).index(&FullRange));
777+
format!("def_map has no key for {} in visit_expr", id).as_slice());
778778
}
779779
let def = &(*def_map)[id];
780780
let sub_span = self.span.span_for_last_ident(span);
@@ -1065,7 +1065,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
10651065
value.index(&FullRange));
10661066

10671067
self.visit_ty(&**ty);
1068-
self.process_generic_params(ty_params, item.span, qualname.index(&FullRange), item.id);
1068+
self.process_generic_params(ty_params, item.span, qualname.as_slice(), item.id);
10691069
},
10701070
ast::ItemMac(_) => (),
10711071
_ => visit::walk_item(self, item),
@@ -1418,7 +1418,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
14181418
let def_map = self.analysis.ty_cx.def_map.borrow();
14191419
if !def_map.contains_key(&id) {
14201420
self.sess.span_bug(p.span,
1421-
format!("def_map has no key for {} in visit_arm", id).index(&FullRange));
1421+
format!("def_map has no key for {} in visit_arm",
1422+
id).index(&FullRange));
14221423
}
14231424
let def = &(*def_map)[id];
14241425
match *def {

src/librustc_trans/save/recorder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'a> FmtStrs<'a> {
237237
if !needs_span {
238238
self.span.sess.span_bug(span,
239239
format!("Called record_with_span for '{}' \
240-
which does not require a span", label).index(&FullRange));
240+
which does not require a span", label).as_slice());
241241
}
242242

243243
let values_str = match self.make_values_str(label, fields, values, span) {

src/librustc_trans/trans/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,8 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
10371037
field_vals.len())
10381038
);
10391039
let mut vals = field_vals;
1040-
vals.push_all(vals_left.index(&FullRange));
1041-
compile_submatch(bcx, pats.index(&FullRange), vals.index(&FullRange), chk, has_genuine_default);
1040+
vals.push_all(vals_left.as_slice());
1041+
compile_submatch(bcx, pats.as_slice(), vals.as_slice(), chk, has_genuine_default);
10421042
return;
10431043
}
10441044
_ => ()

src/librustc_trans/trans/base.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,7 +2246,7 @@ pub fn update_linkage(ccx: &CrateContext,
22462246
if let Some(id) = id {
22472247
let item = ccx.tcx().map.get(id);
22482248
if let ast_map::NodeItem(i) = item {
2249-
if let Some(name) = attr::first_attr_value_str_by_name(i.attrs.index(&FullRange), "linkage") {
2249+
if let Some(name) = attr::first_attr_value_str_by_name(i.attrs.as_slice(), "linkage") {
22502250
if let Some(linkage) = llvm_linkage_by_name(name.get()) {
22512251
llvm::SetLinkage(llval, linkage);
22522252
} else {
@@ -2605,7 +2605,11 @@ pub fn register_fn_llvmty(ccx: &CrateContext,
26052605
llfty: Type) -> ValueRef {
26062606
debug!("register_fn_llvmty id={} sym={}", node_id, sym);
26072607

2608-
let llfn = decl_fn(ccx, sym.index(&FullRange), cc, llfty, ty::FnConverging(ty::mk_nil(ccx.tcx())));
2608+
let llfn = decl_fn(ccx,
2609+
sym.index(&FullRange),
2610+
cc,
2611+
llfty,
2612+
ty::FnConverging(ty::mk_nil(ccx.tcx())));
26092613
finish_register_fn(ccx, sp, sym, node_id, llfn);
26102614
llfn
26112615
}

src/librustc_trans/trans/foreign.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
748748
debug!("calling llrustfn = {}, t = {}",
749749
ccx.tn().val_to_string(llrustfn), t.repr(ccx.tcx()));
750750
let attributes = base::get_fn_llvm_attributes(ccx, t);
751-
let llrust_ret_val = builder.call(llrustfn, llrust_args.index(&FullRange), Some(attributes));
751+
let llrust_ret_val = builder.call(llrustfn, llrust_args.as_slice(), Some(attributes));
752752

753753
// Get the return value where the foreign fn expects it.
754754
let llforeign_ret_ty = match tys.fn_ty.ret_ty.cast {
@@ -869,7 +869,7 @@ fn foreign_types_for_fn_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
869869
ty.repr(ccx.tcx()),
870870
ccx.tn().types_to_str(llsig.llarg_tys.index(&FullRange)),
871871
ccx.tn().type_to_string(llsig.llret_ty),
872-
ccx.tn().types_to_str(fn_ty.arg_tys.iter().map(|t| t.ty).collect::<Vec<_>>().index(&FullRange)),
872+
ccx.tn().types_to_str(fn_ty.arg_tys.iter().map(|t| t.ty).collect::<Vec<_>>().as_slice()),
873873
ccx.tn().type_to_string(fn_ty.ret_ty.ty),
874874
llsig.ret_def);
875875

src/librustc_typeck/astconv.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@ pub fn instantiate_trait_ref<'tcx,AC,RS>(
568568
_ => {
569569
this.tcx().sess.span_fatal(
570570
ast_trait_ref.path.span,
571-
format!("`{}` is not a trait", ast_trait_ref.path.user_string(this.tcx())).index(&FullRange));
571+
format!("`{}` is not a trait",
572+
ast_trait_ref.path.user_string(this.tcx())).index(&FullRange));
572573
}
573574
}
574575
}
@@ -1022,8 +1023,12 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
10221023
ast::TyObjectSum(ref ty, ref bounds) => {
10231024
match ast_ty_to_trait_ref(this, rscope, &**ty, bounds.index(&FullRange)) {
10241025
Ok((trait_ref, projection_bounds)) => {
1025-
trait_ref_to_object_type(this, rscope, ast_ty.span,
1026-
trait_ref, projection_bounds, bounds.index(&FullRange))
1026+
trait_ref_to_object_type(this,
1027+
rscope,
1028+
ast_ty.span,
1029+
trait_ref,
1030+
projection_bounds,
1031+
bounds.index(&FullRange))
10271032
}
10281033
Err(ErrorReported) => {
10291034
this.tcx().types.err

src/librustc_typeck/check/method/confirm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
564564
&**base_expr,
565565
Some(&ty::AdjustDerefRef(base_adjustment.clone())));
566566
let index_expr_ty = self.fcx.expr_ty(&**index_expr);
567-
567+
568568
let result = check::try_index_step(
569569
self.fcx,
570570
MethodCall::expr(expr.id),

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3977,7 +3977,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
39773977
callee::check_call(fcx, expr, &**callee, args.as_slice());
39783978
}
39793979
ast::ExprMethodCall(ident, ref tps, ref args) => {
3980-
check_method_call(fcx, expr, ident, args.index(&FullRange), tps.index(&FullRange), lvalue_pref);
3980+
check_method_call(fcx, expr, ident, args.as_slice(), tps.as_slice(), lvalue_pref);
39813981
let arg_tys = args.iter().map(|a| fcx.expr_ty(&**a));
39823982
let args_err = arg_tys.fold(false,
39833983
|rest_err, a| {

0 commit comments

Comments
 (0)