parent
64c1d3bea7
commit
635a2fa5df
@ -47,7 +47,7 @@ impl StaticConst {
|
|||||||
if let Some(lifetime) = *optional_lifetime {
|
if let Some(lifetime) = *optional_lifetime {
|
||||||
match borrow_type.ty.node {
|
match borrow_type.ty.node {
|
||||||
TyKind::Path(..) | TyKind::Slice(..) | TyKind::Array(..) | TyKind::Tup(..) => {
|
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, "<type>");
|
let snip = snippet(cx, borrow_type.ty.span, "<type>");
|
||||||
let sugg = format!("&{}", snip);
|
let sugg = format!("&{}", snip);
|
||||||
span_lint_and_then(
|
span_lint_and_then(
|
||||||
|
@ -6,7 +6,7 @@ use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintC
|
|||||||
use rustc::{declare_lint_pass, declare_tool_lint};
|
use rustc::{declare_lint_pass, declare_tool_lint};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||||
use syntax::source_map::Span;
|
use syntax::source_map::Span;
|
||||||
use syntax::symbol::keywords;
|
use syntax::symbol::kw;
|
||||||
|
|
||||||
use crate::reexport::*;
|
use crate::reexport::*;
|
||||||
use crate::utils::{last_path_segment, span_lint};
|
use crate::utils::{last_path_segment, span_lint};
|
||||||
@ -476,8 +476,8 @@ struct BodyLifetimeChecker {
|
|||||||
impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker {
|
impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker {
|
||||||
// for lifetimes as parameters of generics
|
// for lifetimes as parameters of generics
|
||||||
fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
|
fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
|
||||||
if lifetime.name.ident().name != keywords::Invalid.name()
|
if lifetime.name.ident().name != kw::Invalid
|
||||||
&& lifetime.name.ident().name != syntax::symbol::keywords::StaticLifetime.name()
|
&& lifetime.name.ident().name != kw::StaticLifetime
|
||||||
{
|
{
|
||||||
self.lifetimes_used_in_body = true;
|
self.lifetimes_used_in_body = true;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use rustc::ty;
|
|||||||
use rustc::ty::{DefIdTree, Ty};
|
use rustc::ty::{DefIdTree, Ty};
|
||||||
use rustc::{declare_lint_pass, declare_tool_lint};
|
use rustc::{declare_lint_pass, declare_tool_lint};
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use syntax_pos::symbol::keywords::SelfUpper;
|
use syntax_pos::symbol::kw;
|
||||||
|
|
||||||
use crate::utils::span_lint_and_sugg;
|
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> {
|
impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
|
||||||
fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
|
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 {
|
if self.item_path.res == path.res {
|
||||||
span_use_self_lint(self.cx, path);
|
span_use_self_lint(self.cx, path);
|
||||||
} else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, CtorKind::Fn), ctor_did) = path.res {
|
} else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, CtorKind::Fn), ctor_did) = path.res {
|
||||||
|
@ -45,7 +45,7 @@ use syntax::ast::{self, LitKind};
|
|||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::ext::hygiene::ExpnFormat;
|
use syntax::ext::hygiene::ExpnFormat;
|
||||||
use syntax::source_map::{Span, DUMMY_SP};
|
use syntax::source_map::{Span, DUMMY_SP};
|
||||||
use syntax::symbol::{keywords, Symbol};
|
use syntax::symbol::{kw, Symbol};
|
||||||
|
|
||||||
use crate::reexport::*;
|
use crate::reexport::*;
|
||||||
|
|
||||||
@ -839,7 +839,7 @@ pub fn remove_blocks(expr: &Expr) -> &Expr {
|
|||||||
|
|
||||||
pub fn is_self(slf: &Arg) -> bool {
|
pub fn is_self(slf: &Arg) -> bool {
|
||||||
if let PatKind::Binding(.., name, _) = slf.pat.node {
|
if let PatKind::Binding(.., name, _) = slf.pat.node {
|
||||||
name.name == keywords::SelfLower.name()
|
name.name == kw::SelfLower
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user