Skip to content

Commit 90ce360

Browse files
committed
Rollup merge of #22592 - nikomatsakis:deprecate-bracket-bracket, r=aturon
r? @aturon
2 parents c2893d1 + 8e61dd4 commit 90ce360

File tree

121 files changed

+732
-732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+732
-732
lines changed

src/libgetopts/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
784784

785785
// FIXME: #5516 should be graphemes not codepoints
786786
// wrapped description
787-
row.push_str(&desc_rows.connect(&desc_sep[..])[]);
787+
row.push_str(&desc_rows.connect(&desc_sep[..]));
788788

789789
row
790790
});

src/librustc/lint/builtin.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl LintPass for RawPointerDerive {
588588
}
589589

590590
fn check_item(&mut self, cx: &Context, item: &ast::Item) {
591-
if !attr::contains_name(&item.attrs[], "automatically_derived") {
591+
if !attr::contains_name(&item.attrs, "automatically_derived") {
592592
return
593593
}
594594
let did = match item.node {
@@ -652,7 +652,7 @@ impl LintPass for UnusedAttributes {
652652

653653
if !attr::is_used(attr) {
654654
cx.span_lint(UNUSED_ATTRIBUTES, attr.span, "unused attribute");
655-
if KNOWN_ATTRIBUTES.contains(&(&attr.name()[], AttributeType::CrateLevel)) {
655+
if KNOWN_ATTRIBUTES.contains(&(&attr.name(), AttributeType::CrateLevel)) {
656656
let msg = match attr.node.style {
657657
ast::AttrOuter => "crate-level attribute should be an inner \
658658
attribute: add an exclamation mark: #![foo]",
@@ -732,7 +732,7 @@ impl LintPass for UnusedResults {
732732
ty::ty_enum(did, _) => {
733733
if ast_util::is_local(did) {
734734
if let ast_map::NodeItem(it) = cx.tcx.map.get(did.node) {
735-
warned |= check_must_use(cx, &it.attrs[], s.span);
735+
warned |= check_must_use(cx, &it.attrs, s.span);
736736
}
737737
} else {
738738
let attrs = csearch::get_item_attrs(&cx.sess().cstore, did);
@@ -1093,7 +1093,7 @@ impl UnusedParens {
10931093
if !necessary {
10941094
cx.span_lint(UNUSED_PARENS, value.span,
10951095
&format!("unnecessary parentheses around {}",
1096-
msg)[])
1096+
msg))
10971097
}
10981098
}
10991099

@@ -1235,7 +1235,7 @@ impl LintPass for NonShorthandFieldPatterns {
12351235
if ident.node.as_str() == fieldpat.node.ident.as_str() {
12361236
cx.span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span,
12371237
&format!("the `{}:` in this pattern is redundant and can \
1238-
be removed", ident.node.as_str())[])
1238+
be removed", ident.node.as_str()))
12391239
}
12401240
}
12411241
}
@@ -1383,7 +1383,7 @@ impl LintPass for UnusedMut {
13831383
fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
13841384
if let ast::ExprMatch(_, ref arms, _) = e.node {
13851385
for a in arms {
1386-
self.check_unused_mut_pat(cx, &a.pats[])
1386+
self.check_unused_mut_pat(cx, &a.pats)
13871387
}
13881388
}
13891389
}
@@ -1504,7 +1504,7 @@ impl MissingDoc {
15041504
});
15051505
if !has_doc {
15061506
cx.span_lint(MISSING_DOCS, sp,
1507-
&format!("missing documentation for {}", desc)[]);
1507+
&format!("missing documentation for {}", desc));
15081508
}
15091509
}
15101510
}
@@ -1540,7 +1540,7 @@ impl LintPass for MissingDoc {
15401540
}
15411541

15421542
fn check_crate(&mut self, cx: &Context, krate: &ast::Crate) {
1543-
self.check_missing_docs_attrs(cx, None, &krate.attrs[],
1543+
self.check_missing_docs_attrs(cx, None, &krate.attrs,
15441544
krate.span, "crate");
15451545
}
15461546

@@ -1554,7 +1554,7 @@ impl LintPass for MissingDoc {
15541554
ast::ItemTy(..) => "a type alias",
15551555
_ => return
15561556
};
1557-
self.check_missing_docs_attrs(cx, Some(it.id), &it.attrs[],
1557+
self.check_missing_docs_attrs(cx, Some(it.id), &it.attrs,
15581558
it.span, desc);
15591559
}
15601560

@@ -1567,13 +1567,13 @@ impl LintPass for MissingDoc {
15671567

15681568
// Otherwise, doc according to privacy. This will also check
15691569
// doc for default methods defined on traits.
1570-
self.check_missing_docs_attrs(cx, Some(m.id), &m.attrs[],
1570+
self.check_missing_docs_attrs(cx, Some(m.id), &m.attrs,
15711571
m.span, "a method");
15721572
}
15731573
}
15741574

15751575
fn check_ty_method(&mut self, cx: &Context, tm: &ast::TypeMethod) {
1576-
self.check_missing_docs_attrs(cx, Some(tm.id), &tm.attrs[],
1576+
self.check_missing_docs_attrs(cx, Some(tm.id), &tm.attrs,
15771577
tm.span, "a type method");
15781578
}
15791579

@@ -1583,14 +1583,14 @@ impl LintPass for MissingDoc {
15831583
let cur_struct_def = *self.struct_def_stack.last()
15841584
.expect("empty struct_def_stack");
15851585
self.check_missing_docs_attrs(cx, Some(cur_struct_def),
1586-
&sf.node.attrs[], sf.span,
1586+
&sf.node.attrs, sf.span,
15871587
"a struct field")
15881588
}
15891589
}
15901590
}
15911591

15921592
fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) {
1593-
self.check_missing_docs_attrs(cx, Some(v.node.id), &v.node.attrs[],
1593+
self.check_missing_docs_attrs(cx, Some(v.node.id), &v.node.attrs,
15941594
v.span, "a variant");
15951595
assert!(!self.in_variant);
15961596
self.in_variant = true;

src/librustc/lint/context.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl LintStore {
105105
}
106106

107107
pub fn get_lints<'t>(&'t self) -> &'t [(&'static Lint, bool)] {
108-
&self.lints[]
108+
&self.lints
109109
}
110110

111111
pub fn get_lint_groups<'t>(&'t self) -> Vec<(&'static str, Vec<LintId>, bool)> {
@@ -276,7 +276,7 @@ impl LintStore {
276276
.collect::<Vec<()>>();
277277
}
278278
None => sess.err(&format!("unknown {} flag: {}",
279-
level.as_str(), lint_name)[]),
279+
level.as_str(), lint_name)),
280280
}
281281
}
282282
}
@@ -527,7 +527,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
527527
self.tcx.sess.span_err(span,
528528
&format!("{}({}) overruled by outer forbid({})",
529529
level.as_str(), lint_name,
530-
lint_name)[]);
530+
lint_name));
531531
} else if now != level {
532532
let src = self.lints.get_level_source(lint_id).1;
533533
self.level_stack.push((lint_id, (now, src)));
@@ -562,15 +562,15 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
562562

563563
impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
564564
fn visit_item(&mut self, it: &ast::Item) {
565-
self.with_lint_attrs(&it.attrs[], |cx| {
565+
self.with_lint_attrs(&it.attrs, |cx| {
566566
run_lints!(cx, check_item, it);
567567
cx.visit_ids(|v| v.visit_item(it));
568568
visit::walk_item(cx, it);
569569
})
570570
}
571571

572572
fn visit_foreign_item(&mut self, it: &ast::ForeignItem) {
573-
self.with_lint_attrs(&it.attrs[], |cx| {
573+
self.with_lint_attrs(&it.attrs, |cx| {
574574
run_lints!(cx, check_foreign_item, it);
575575
visit::walk_foreign_item(cx, it);
576576
})
@@ -595,7 +595,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
595595
body: &'v ast::Block, span: Span, id: ast::NodeId) {
596596
match fk {
597597
visit::FkMethod(_, _, m) => {
598-
self.with_lint_attrs(&m.attrs[], |cx| {
598+
self.with_lint_attrs(&m.attrs, |cx| {
599599
run_lints!(cx, check_fn, fk, decl, body, span, id);
600600
cx.visit_ids(|v| {
601601
v.visit_fn(fk, decl, body, span, id);
@@ -611,7 +611,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
611611
}
612612

613613
fn visit_ty_method(&mut self, t: &ast::TypeMethod) {
614-
self.with_lint_attrs(&t.attrs[], |cx| {
614+
self.with_lint_attrs(&t.attrs, |cx| {
615615
run_lints!(cx, check_ty_method, t);
616616
visit::walk_ty_method(cx, t);
617617
})
@@ -628,14 +628,14 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
628628
}
629629

630630
fn visit_struct_field(&mut self, s: &ast::StructField) {
631-
self.with_lint_attrs(&s.node.attrs[], |cx| {
631+
self.with_lint_attrs(&s.node.attrs, |cx| {
632632
run_lints!(cx, check_struct_field, s);
633633
visit::walk_struct_field(cx, s);
634634
})
635635
}
636636

637637
fn visit_variant(&mut self, v: &ast::Variant, g: &ast::Generics) {
638-
self.with_lint_attrs(&v.node.attrs[], |cx| {
638+
self.with_lint_attrs(&v.node.attrs, |cx| {
639639
run_lints!(cx, check_variant, v, g);
640640
visit::walk_variant(cx, v, g);
641641
run_lints!(cx, check_variant_post, v, g);
@@ -779,7 +779,7 @@ pub fn check_crate(tcx: &ty::ctxt,
779779
let mut cx = Context::new(tcx, krate, exported_items);
780780

781781
// Visit the whole crate.
782-
cx.with_lint_attrs(&krate.attrs[], |cx| {
782+
cx.with_lint_attrs(&krate.attrs, |cx| {
783783
cx.visit_id(ast::CRATE_NODE_ID);
784784
cx.visit_ids(|v| {
785785
v.visited_outermost = true;

src/librustc/metadata/creader.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn dump_crates(cstore: &CStore) {
6161
}
6262

6363
fn should_link(i: &ast::Item) -> bool {
64-
!attr::contains_name(&i.attrs[], "no_link")
64+
!attr::contains_name(&i.attrs, "no_link")
6565
}
6666

6767
struct CrateInfo {
@@ -85,7 +85,7 @@ pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
8585
for c in s.chars() {
8686
if c.is_alphanumeric() { continue }
8787
if c == '_' || c == '-' { continue }
88-
err(&format!("invalid character `{}` in crate name: `{}`", c, s)[]);
88+
err(&format!("invalid character `{}` in crate name: `{}`", c, s));
8989
}
9090
match sess {
9191
Some(sess) => sess.abort_if_errors(),
@@ -210,8 +210,8 @@ impl<'a> CrateReader<'a> {
210210
match self.extract_crate_info(i) {
211211
Some(info) => {
212212
let (cnum, _, _) = self.resolve_crate(&None,
213-
&info.ident[],
214-
&info.name[],
213+
&info.ident,
214+
&info.name,
215215
None,
216216
i.span,
217217
PathKind::Crate);
@@ -268,7 +268,7 @@ impl<'a> CrateReader<'a> {
268268
} else {
269269
self.sess.span_err(m.span,
270270
&format!("unknown kind: `{}`",
271-
k)[]);
271+
k));
272272
cstore::NativeUnknown
273273
}
274274
}
@@ -413,7 +413,7 @@ impl<'a> CrateReader<'a> {
413413
hash: hash.map(|a| &*a),
414414
filesearch: self.sess.target_filesearch(kind),
415415
target: &self.sess.target.target,
416-
triple: &self.sess.opts.target_triple[],
416+
triple: &self.sess.opts.target_triple,
417417
root: root,
418418
rejected_via_hash: vec!(),
419419
rejected_via_triple: vec!(),
@@ -440,8 +440,8 @@ impl<'a> CrateReader<'a> {
440440
decoder::get_crate_deps(cdata).iter().map(|dep| {
441441
debug!("resolving dep crate {} hash: `{}`", dep.name, dep.hash);
442442
let (local_cnum, _, _) = self.resolve_crate(root,
443-
&dep.name[],
444-
&dep.name[],
443+
&dep.name,
444+
&dep.name,
445445
Some(&dep.hash),
446446
span,
447447
PathKind::Dependency);
@@ -450,7 +450,7 @@ impl<'a> CrateReader<'a> {
450450
}
451451

452452
fn read_extension_crate(&mut self, span: Span, info: &CrateInfo) -> ExtensionCrate {
453-
let target_triple = &self.sess.opts.target_triple[];
453+
let target_triple = &self.sess.opts.target_triple[..];
454454
let is_cross = target_triple != config::host_triple();
455455
let mut should_link = info.should_link && !is_cross;
456456
let mut target_only = false;
@@ -493,8 +493,8 @@ impl<'a> CrateReader<'a> {
493493
PathKind::Crate).is_none();
494494
let metadata = if register {
495495
// Register crate now to avoid double-reading metadata
496-
let (_, cmd, _) = self.register_crate(&None, &info.ident[],
497-
&info.name[], span, library);
496+
let (_, cmd, _) = self.register_crate(&None, &info.ident,
497+
&info.name, span, library);
498498
PMDSource::Registered(cmd)
499499
} else {
500500
// Not registering the crate; just hold on to the metadata

src/librustc/metadata/csearch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn get_item_path(tcx: &ty::ctxt, def: ast::DefId) -> Vec<ast_map::PathElem>
9292

9393
// FIXME #1920: This path is not always correct if the crate is not linked
9494
// into the root namespace.
95-
let mut r = vec![ast_map::PathMod(token::intern(&cdata.name[]))];
95+
let mut r = vec![ast_map::PathMod(token::intern(&cdata.name))];
9696
r.push_all(&path);
9797
r
9898
}
@@ -391,7 +391,7 @@ pub fn is_staged_api(cstore: &cstore::CStore, def: ast::DefId) -> bool {
391391
let cdata = cstore.get_crate_data(def.krate);
392392
let attrs = decoder::get_crate_attributes(cdata.data());
393393
for attr in &attrs {
394-
if &attr.name()[] == "staged_api" {
394+
if &attr.name()[..] == "staged_api" {
395395
match attr.node.value.node { ast::MetaWord(_) => return true, _ => (/*pass*/) }
396396
}
397397
}

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
12251225
}
12261226
reader::tagged_docs(depsdoc, tag_crate_dep, |depdoc| {
12271227
let name = docstr(depdoc, tag_crate_dep_crate_name);
1228-
let hash = Svh::new(&docstr(depdoc, tag_crate_dep_hash)[]);
1228+
let hash = Svh::new(&docstr(depdoc, tag_crate_dep_hash));
12291229
deps.push(CrateDep {
12301230
cnum: crate_num,
12311231
name: name,

0 commit comments

Comments
 (0)