mirror of https://github.com/rust-lang/rust.git
This commit is contained in:
parent
3e1760cb04
commit
51632530d7
|
@ -17,7 +17,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
|
|||
use rustc_errors::Applicability;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::{sym, LocalInternedString, Symbol};
|
||||
use syntax::symbol::{sym, Symbol, SymbolStr};
|
||||
|
||||
use crate::utils::usage::mutated_variables;
|
||||
use crate::utils::{
|
||||
|
@ -1148,8 +1148,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
|
|||
}
|
||||
|
||||
let (method_names, arg_lists, method_spans) = method_calls(expr, 2);
|
||||
let method_names: Vec<LocalInternedString> = method_names.iter().map(|s| s.as_str()).collect();
|
||||
let method_names: Vec<&str> = method_names.iter().map(std::convert::AsRef::as_ref).collect();
|
||||
let method_names: Vec<SymbolStr> = method_names.iter().map(|s| s.as_str()).collect();
|
||||
let method_names: Vec<&str> = method_names.iter().map(|s| &**s).collect();
|
||||
|
||||
match method_names.as_slice() {
|
||||
["unwrap", "get"] => lint_get_unwrap(cx, expr, arg_lists[1], false),
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::cmp::Ordering;
|
|||
use syntax::ast::*;
|
||||
use syntax::attr;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use syntax::symbol::SymbolStr;
|
||||
use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor};
|
||||
|
||||
declare_clippy_lint! {
|
||||
|
@ -72,7 +72,7 @@ pub struct NonExpressiveNames {
|
|||
impl_lint_pass!(NonExpressiveNames => [SIMILAR_NAMES, MANY_SINGLE_CHAR_NAMES, JUST_UNDERSCORES_AND_DIGITS]);
|
||||
|
||||
struct ExistingName {
|
||||
interned: LocalInternedString,
|
||||
interned: SymbolStr,
|
||||
span: Span,
|
||||
len: usize,
|
||||
whitelist: &'static [&'static str],
|
||||
|
|
|
@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PathBufPushOverwrite {
|
|||
if let Some(get_index_arg) = args.get(1);
|
||||
if let ExprKind::Lit(ref lit) = get_index_arg.kind;
|
||||
if let LitKind::Str(ref path_lit, _) = lit.node;
|
||||
if let pushed_path = Path::new(&path_lit.as_str());
|
||||
if let pushed_path = Path::new(&*path_lit.as_str());
|
||||
if let Some(pushed_path_lit) = pushed_path.to_str();
|
||||
if pushed_path.has_root();
|
||||
if let Some(root) = pushed_path.components().next();
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
|||
use rustc::{declare_lint_pass, declare_tool_lint};
|
||||
use syntax::ast::*;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use syntax::symbol::SymbolStr;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for imports that remove "unsafe" from an item's
|
||||
|
@ -73,6 +73,6 @@ fn unsafe_to_safe_check(old_name: Ident, new_name: Ident, cx: &EarlyContext<'_>,
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
fn contains_unsafe(name: &LocalInternedString) -> bool {
|
||||
fn contains_unsafe(name: &SymbolStr) -> bool {
|
||||
name.contains("Unsafe") || name.contains("unsafe")
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
|||
use rustc_errors::Applicability;
|
||||
use syntax::ast::{Crate as AstCrate, ItemKind, Name};
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::symbol::LocalInternedString;
|
||||
use syntax_pos::symbol::SymbolStr;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for various things we like to keep tidy in clippy.
|
||||
|
@ -112,7 +112,7 @@ impl EarlyLintPass for ClippyLintsInternal {
|
|||
if let ItemKind::Mod(ref utils_mod) = utils.kind {
|
||||
if let Some(paths) = utils_mod.items.iter().find(|item| item.ident.name.as_str() == "paths") {
|
||||
if let ItemKind::Mod(ref paths_mod) = paths.kind {
|
||||
let mut last_name: Option<LocalInternedString> = None;
|
||||
let mut last_name: Option<SymbolStr> = None;
|
||||
for item in &*paths_mod.items {
|
||||
let name = item.ident.as_str();
|
||||
if let Some(ref last_name) = last_name {
|
||||
|
@ -279,8 +279,8 @@ declare_lint_pass!(OuterExpnDataPass => [OUTER_EXPN_EXPN_DATA]);
|
|||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OuterExpnDataPass {
|
||||
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
|
||||
let (method_names, arg_lists, spans) = method_calls(expr, 2);
|
||||
let method_names: Vec<LocalInternedString> = method_names.iter().map(|s| s.as_str()).collect();
|
||||
let method_names: Vec<&str> = method_names.iter().map(std::convert::AsRef::as_ref).collect();
|
||||
let method_names: Vec<SymbolStr> = method_names.iter().map(|s| s.as_str()).collect();
|
||||
let method_names: Vec<&str> = method_names.iter().map(|s| &**s).collect();
|
||||
if_chain! {
|
||||
if let ["expn_data", "outer_expn"] = method_names.as_slice();
|
||||
let args = arg_lists[1];
|
||||
|
|
Loading…
Reference in New Issue