From e3c4ec74d7f0661fdcab30566c2065ecafb66ecb Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 23 Sep 2017 13:30:29 -0700 Subject: [PATCH 1/4] Rust upgrade to rustc 1.22.0-nightly (14039a42a 2017-09-22) --- clippy_lints/src/lifetimes.rs | 18 +++++++++--------- clippy_lints/src/types.rs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 9e7e19a8d..5cbb854be 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -113,7 +113,7 @@ fn check_fn_inner<'a, 'tcx>( .parameters .lifetimes; for bound in bounds { - if bound.name != "'static" && !bound.is_elided() { + if bound.name.name() != "'static" && !bound.is_elided() { return; } bounds_lts.push(bound); @@ -225,7 +225,7 @@ fn allowed_lts_from(named_lts: &[LifetimeDef]) -> HashSet { let mut allowed_lts = HashSet::new(); for lt in named_lts { if lt.bounds.is_empty() { - allowed_lts.insert(RefLt::Named(lt.lifetime.name)); + allowed_lts.insert(RefLt::Named(lt.lifetime.name.name())); } } allowed_lts.insert(RefLt::Unnamed); @@ -235,8 +235,8 @@ fn allowed_lts_from(named_lts: &[LifetimeDef]) -> HashSet { fn lts_from_bounds<'a, T: Iterator>(mut vec: Vec, bounds_lts: T) -> Vec { for lt in bounds_lts { - if lt.name != "'static" { - vec.push(RefLt::Named(lt.name)); + if lt.name.name() != "'static" { + vec.push(RefLt::Named(lt.name.name())); } } @@ -266,12 +266,12 @@ impl<'v, 't> RefVisitor<'v, 't> { fn record(&mut self, lifetime: &Option) { if let Some(ref lt) = *lifetime { - if lt.name == "'static" { + if lt.name.name() == "'static" { self.lts.push(RefLt::Static); } else if lt.is_elided() { self.lts.push(RefLt::Unnamed); } else { - self.lts.push(RefLt::Named(lt.name)); + self.lts.push(RefLt::Named(lt.name.name())); } } else { self.lts.push(RefLt::Unnamed); @@ -396,7 +396,7 @@ struct LifetimeChecker { impl<'tcx> Visitor<'tcx> for LifetimeChecker { // for lifetimes as parameters of generics fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) { - self.map.remove(&lifetime.name); + self.map.remove(&lifetime.name.name()); } fn visit_lifetime_def(&mut self, _: &'tcx LifetimeDef) { @@ -415,7 +415,7 @@ fn report_extra_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, func: &'tcx let hs = generics .lifetimes .iter() - .map(|lt| (lt.lifetime.name, lt.lifetime.span)) + .map(|lt| (lt.lifetime.name.name(), lt.lifetime.span)) .collect(); let mut checker = LifetimeChecker { map: hs }; @@ -434,7 +434,7 @@ struct BodyLifetimeChecker { impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker { // for lifetimes as parameters of generics fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) { - if lifetime.name != keywords::Invalid.name() && lifetime.name != "'static" { + if lifetime.name.name() != keywords::Invalid.name() && lifetime.name.name() != "'static" { self.lifetimes_used_in_body = true; } } diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 567e8b542..90f1e8779 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -223,7 +223,7 @@ fn check_ty(cx: &LateContext, ast_ty: &hir::Ty, is_local: bool) { let ltopt = if lt.is_elided() { "".to_owned() } else { - format!("{} ", lt.name.as_str()) + format!("{} ", lt.name.name().as_str()) }; let mutopt = if *mutbl == Mutability::MutMutable { "mut " From 50e410e7968540cfd55b43720c599f653d7d1162 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 23 Sep 2017 13:35:06 -0700 Subject: [PATCH 2/4] Update test expectations --- tests/ui/mut_mut.stderr | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/ui/mut_mut.stderr b/tests/ui/mut_mut.stderr index dd3a85c97..7a7bb840b 100644 --- a/tests/ui/mut_mut.stderr +++ b/tests/ui/mut_mut.stderr @@ -27,12 +27,6 @@ error: this expression mutably borrows a mutable reference. Consider reborrowing 26 | let mut y = &mut x; | ^^^^^^ -error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:17 - | -30 | let y : &mut &mut u32 = &mut &mut 2; - | ^^^^^^^^^^^^^ - error: generally you want to avoid `&mut &mut _` if possible --> $DIR/mut_mut.rs:30:33 | @@ -45,6 +39,18 @@ error: generally you want to avoid `&mut &mut _` if possible 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ +error: generally you want to avoid `&mut &mut _` if possible + --> $DIR/mut_mut.rs:30:17 + | +30 | let y : &mut &mut u32 = &mut &mut 2; + | ^^^^^^^^^^^^^ + +error: generally you want to avoid `&mut &mut _` if possible + --> $DIR/mut_mut.rs:35:38 + | +35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; + | ^^^^^^^^^^^^^^^^ + error: generally you want to avoid `&mut &mut _` if possible --> $DIR/mut_mut.rs:35:17 | @@ -57,12 +63,6 @@ error: generally you want to avoid `&mut &mut _` if possible 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ -error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:38 - | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; - | ^^^^^^^^^^^^^^^^ - error: generally you want to avoid `&mut &mut _` if possible --> $DIR/mut_mut.rs:35:17 | From 287e997b1e2a92a0e887c1918ad6f1c9ed5e7a4f Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 23 Sep 2017 13:36:18 -0700 Subject: [PATCH 3/4] Bump to 0.0.163 --- CHANGELOG.md | 3 +++ Cargo.toml | 4 ++-- clippy_lints/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d000f2dd9..15a0ee74e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. +## 0.0.163 +* Update to *rustc 1.22.0-nightly (14039a42a 2017-09-22)* + ## 0.0.162 * Update to *rustc 1.22.0-nightly (0701b37d9 2017-09-18)* * New lint: [`chars_last_cmp`] diff --git a/Cargo.toml b/Cargo.toml index 46780712a..16aaf148c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.162" +version = "0.0.163" authors = [ "Manish Goregaokar ", "Andre Bogus ", @@ -31,7 +31,7 @@ path = "src/main.rs" [dependencies] # begin automatic update -clippy_lints = { version = "0.0.162", path = "clippy_lints" } +clippy_lints = { version = "0.0.163", path = "clippy_lints" } # end automatic update cargo_metadata = "0.2" diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index ef527dbf0..96bd05162 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.0.162" +version = "0.0.163" # end automatic update authors = [ "Manish Goregaokar ", From a822cab01f7f7c0db3fb55182e38a30b4fcbd3e4 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 23 Sep 2017 13:36:40 -0700 Subject: [PATCH 4/4] fix docs --- PUBLISH.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PUBLISH.md b/PUBLISH.md index 1ff3f2b4b..a9496d5b4 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -7,7 +7,7 @@ Steps to publish a new clippy version - `git push` - Wait for Travis's approval. - Merge. -- `cargo publish` in `./clippy_clints`. +- `cargo publish` in `./clippy_lints`. - `cargo publish` in the root directory. - `git pull`. - `git tag -s v0.0.X -m "v0.0.X"`.