From 635a2fa5dfe3c217b02de601a7ac616899032749 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Thu, 23 May 2019 07:19:25 +0200 Subject: [PATCH 1/2] Rustup to https://github.com/rust-lang/rust/pull/60740 changelog: none --- clippy_lints/src/const_static_lifetime.rs | 2 +- clippy_lints/src/lifetimes.rs | 6 +++--- clippy_lints/src/use_self.rs | 4 ++-- clippy_lints/src/utils/mod.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clippy_lints/src/const_static_lifetime.rs b/clippy_lints/src/const_static_lifetime.rs index 150d379cc..fefd18095 100644 --- a/clippy_lints/src/const_static_lifetime.rs +++ b/clippy_lints/src/const_static_lifetime.rs @@ -47,7 +47,7 @@ impl StaticConst { if let Some(lifetime) = *optional_lifetime { match borrow_type.ty.node { TyKind::Path(..) | TyKind::Slice(..) | TyKind::Array(..) | TyKind::Tup(..) => { - if lifetime.ident.name == syntax::symbol::keywords::StaticLifetime.name() { + if lifetime.ident.name == syntax::symbol::kw::StaticLifetime { let snip = snippet(cx, borrow_type.ty.span, ""); let sugg = format!("&{}", snip); span_lint_and_then( diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index ff75fbaa5..4f27d38c1 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -6,7 +6,7 @@ use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintC use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use syntax::source_map::Span; -use syntax::symbol::keywords; +use syntax::symbol::kw; use crate::reexport::*; use crate::utils::{last_path_segment, span_lint}; @@ -476,8 +476,8 @@ 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.ident().name != keywords::Invalid.name() - && lifetime.name.ident().name != syntax::symbol::keywords::StaticLifetime.name() + if lifetime.name.ident().name != kw::Invalid + && lifetime.name.ident().name != kw::StaticLifetime { self.lifetimes_used_in_body = true; } diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 1a0a3474d..c6ada386f 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -8,7 +8,7 @@ use rustc::ty; use rustc::ty::{DefIdTree, Ty}; use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_errors::Applicability; -use syntax_pos::symbol::keywords::SelfUpper; +use syntax_pos::symbol::kw; use crate::utils::span_lint_and_sugg; @@ -220,7 +220,7 @@ struct UseSelfVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> { fn visit_path(&mut self, path: &'tcx Path, _id: HirId) { - if path.segments.last().expect(SEGMENTS_MSG).ident.name != SelfUpper.name() { + if path.segments.last().expect(SEGMENTS_MSG).ident.name != kw::SelfUpper { if self.item_path.res == path.res { span_use_self_lint(self.cx, path); } else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, CtorKind::Fn), ctor_did) = path.res { diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 3d22732a6..b28615ec5 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -45,7 +45,7 @@ use syntax::ast::{self, LitKind}; use syntax::attr; use syntax::ext::hygiene::ExpnFormat; use syntax::source_map::{Span, DUMMY_SP}; -use syntax::symbol::{keywords, Symbol}; +use syntax::symbol::{kw, Symbol}; use crate::reexport::*; @@ -839,7 +839,7 @@ pub fn remove_blocks(expr: &Expr) -> &Expr { pub fn is_self(slf: &Arg) -> bool { if let PatKind::Binding(.., name, _) = slf.pat.node { - name.name == keywords::SelfLower.name() + name.name == kw::SelfLower } else { false } From edb698105fdd123e5b4ac8880c861b508a80d55a Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Thu, 23 May 2019 07:24:53 +0200 Subject: [PATCH 2/2] cargo fmt Roses are red Violets are blue `Add rustfmt to a pre-commit hook` is what I should do. --- clippy_lints/src/lifetimes.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 4f27d38c1..8c167db91 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -476,9 +476,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.ident().name != kw::Invalid - && lifetime.name.ident().name != kw::StaticLifetime - { + if lifetime.name.ident().name != kw::Invalid && lifetime.name.ident().name != kw::StaticLifetime { self.lifetimes_used_in_body = true; } }