Skip to content

Commit 1ef0ad8

Browse files
committed
Change &String[..] to just &String, since it coerces to &str automatically.
1 parent 6812ca1 commit 1ef0ad8

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/librustc_trans/save/dump_csv.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
169169
};
170170
self.fmt.sub_mod_ref_str(path.span,
171171
*span,
172-
&qualname[..],
172+
&qualname,
173173
self.cur_scope);
174174
}
175175
}
@@ -192,7 +192,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
192192
};
193193
self.fmt.sub_mod_ref_str(path.span,
194194
*span,
195-
&qualname[..],
195+
&qualname,
196196
self.cur_scope);
197197
}
198198
}
@@ -211,7 +211,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
211211
let (ref span, ref qualname) = sub_paths[len-2];
212212
self.fmt.sub_type_ref_str(path.span,
213213
*span,
214-
&qualname[..]);
214+
&qualname);
215215

216216
// write the other sub-paths
217217
if len <= 2 {
@@ -221,7 +221,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
221221
for &(ref span, ref qualname) in sub_paths {
222222
self.fmt.sub_mod_ref_str(path.span,
223223
*span,
224-
&qualname[..],
224+
&qualname,
225225
self.cur_scope);
226226
}
227227
}
@@ -293,7 +293,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
293293
id,
294294
qualname,
295295
&path_to_string(p),
296-
&typ[..]);
296+
&typ);
297297
}
298298
}
299299
}
@@ -451,9 +451,9 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
451451
Some(sub_span) => self.fmt.field_str(field.span,
452452
Some(sub_span),
453453
field.node.id,
454-
&name[..],
455-
&qualname[..],
456-
&typ[..],
454+
&name,
455+
&qualname,
456+
&typ,
457457
scope_id),
458458
None => self.sess.span_bug(field.span,
459459
&format!("Could not find sub-span for field {}",
@@ -485,7 +485,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
485485
self.fmt.typedef_str(full_span,
486486
Some(*param_ss),
487487
param.id,
488-
&name[..],
488+
&name,
489489
"");
490490
}
491491
self.visit_generics(generics);
@@ -561,7 +561,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
561561
sub_span,
562562
id,
563563
&get_ident((*ident).clone()),
564-
&qualname[..],
564+
&qualname,
565565
&self.span.snippet(expr.span),
566566
&ty_to_string(&*typ),
567567
self.cur_scope);
@@ -587,17 +587,17 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
587587
sub_span,
588588
item.id,
589589
ctor_id,
590-
&qualname[..],
590+
&qualname,
591591
self.cur_scope,
592-
&val[..]);
592+
&val);
593593

594594
// fields
595595
for field in &def.fields {
596-
self.process_struct_field_def(field, &qualname[..], item.id);
596+
self.process_struct_field_def(field, &qualname, item.id);
597597
self.visit_ty(&*field.node.ty);
598598
}
599599

600-
self.process_generic_params(ty_params, item.span, &qualname[..], item.id);
600+
self.process_generic_params(ty_params, item.span, &qualname, item.id);
601601
}
602602

603603
fn process_enum(&mut self,
@@ -722,9 +722,9 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
722722
self.fmt.trait_str(item.span,
723723
sub_span,
724724
item.id,
725-
&qualname[..],
725+
&qualname,
726726
self.cur_scope,
727-
&val[..]);
727+
&val);
728728

729729
// super-traits
730730
for super_bound in &**trait_refs {
@@ -756,7 +756,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
756756
}
757757

758758
// walk generics and methods
759-
self.process_generic_params(generics, item.span, &qualname[..], item.id);
759+
self.process_generic_params(generics, item.span, &qualname, item.id);
760760
for method in methods {
761761
self.visit_trait_item(method)
762762
}
@@ -996,7 +996,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
996996
self.cur_scope);
997997

998998
// walk receiver and args
999-
visit::walk_exprs(self, &args[..]);
999+
visit::walk_exprs(self, &args);
10001000
}
10011001

10021002
fn process_pat(&mut self, p:&ast::Pat) {
@@ -1155,7 +1155,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11551155
item.id,
11561156
cnum,
11571157
name,
1158-
&location[..],
1158+
&location,
11591159
self.cur_scope);
11601160
}
11611161
ast::ItemFn(ref decl, _, _, _, ref ty_params, ref body) =>
@@ -1190,8 +1190,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11901190
self.fmt.typedef_str(item.span,
11911191
sub_span,
11921192
item.id,
1193-
&qualname[..],
1194-
&value[..]);
1193+
&qualname,
1194+
&value);
11951195

11961196
self.visit_ty(&**ty);
11971197
self.process_generic_params(ty_params, item.span, &qualname, item.id);
@@ -1343,7 +1343,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
13431343

13441344
let mut id = String::from_str("$");
13451345
id.push_str(&ex.id.to_string());
1346-
self.process_formals(&decl.inputs, &id[..]);
1346+
self.process_formals(&decl.inputs, &id);
13471347

13481348
// walk arg and return types
13491349
for arg in &decl.inputs {
@@ -1403,7 +1403,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
14031403
Some(p.span),
14041404
id,
14051405
&path_to_string(p),
1406-
&value[..],
1406+
&value,
14071407
"")
14081408
}
14091409
def::DefVariant(..) | def::DefTy(..) | def::DefStruct(..) => {
@@ -1461,8 +1461,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
14611461
sub_span,
14621462
id,
14631463
&path_to_string(p),
1464-
&value[..],
1465-
&typ[..]);
1464+
&value,
1465+
&typ);
14661466
}
14671467

14681468
// Just walk the initialiser and type (don't want to walk the pattern again).

src/librustc_trans/save/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ pub fn process_crate(sess: &Session,
367367

368368
let mut visitor = dump_csv::DumpCsvVisitor::new(sess, analysis, output_file);
369369

370-
visitor.dump_crate_info(&cratename[..], krate);
370+
visitor.dump_crate_info(&cratename, krate);
371371
visit::walk_crate(&mut visitor, krate);
372372
}
373373

0 commit comments

Comments
 (0)