mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
parent
07c2e61436
commit
76321d3300
52 changed files with 61 additions and 61 deletions
|
@ -2,7 +2,7 @@ use crate::utils::span_lint;
|
|||
use rustc::hir;
|
||||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for plain integer arithmetic.
|
||||
///
|
||||
|
|
|
@ -12,7 +12,7 @@ use if_chain::if_chain;
|
|||
use rustc::ty::{self, TyCtxt};
|
||||
use semver::Version;
|
||||
use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for items annotated with `#[inline(always)]`,
|
||||
/// unless the annotated function is empty or simply panics.
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{span_lint, span_lint_and_then};
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::consts::{constant, Constant};
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use rustc::hir::*;
|
||||
use rustc::hir::intravisit::*;
|
||||
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
|
||||
use syntax::codemap::{dummy_spanned, Span, DUMMY_SP};
|
||||
use syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use crate::utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq, get_trait_def_id, implements_trait};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc::hir::*;
|
|||
use rustc::ty;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use syntax::ast::{Attribute, NodeId};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use if_chain::if_chain;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::hir::*;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use pulldown_cmark;
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast;
|
||||
use syntax::codemap::{BytePos, Span};
|
||||
use syntax::source_map::{BytePos, Span};
|
||||
use syntax_pos::Pos;
|
||||
use crate::utils::span_lint;
|
||||
use url::Url;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use rustc::hir::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
use crate::utils::{snippet, span_lint_and_sugg, SpanlessEq};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use rustc::hir::*;
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use syntax::codemap::Spanned;
|
||||
use syntax::source_map::Spanned;
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::paths;
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::SpanlessEq;
|
||||
use crate::utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use rustc::hir::def::Def;
|
|||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::span_lint;
|
||||
|
||||
/// **What it does:** Checks for `use Enum::*`.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use crate::utils::{span_help_and_lint, span_lint};
|
||||
use crate::utils::{camel_case_from, camel_case_until, in_macro};
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::consts::{constant_simple, Constant};
|
|||
use rustc::hir::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{in_macro, span_lint};
|
||||
|
||||
/// **What it does:** Checks for erasing operations, e.g. `x * 0`.
|
||||
|
|
|
@ -9,7 +9,7 @@ use rustc::ty::{self, Ty};
|
|||
use rustc::ty::layout::LayoutOf;
|
||||
use rustc::util::nodemap::NodeSet;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::span_lint;
|
||||
|
||||
pub struct Pass {
|
||||
|
|
|
@ -8,7 +8,7 @@ use rustc::hir::def::Def;
|
|||
use std::collections::HashSet;
|
||||
use syntax::ast;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{iter_input_pats, span_lint, type_is_unsafe_function};
|
||||
|
||||
/// **What it does:** Checks for functions with too many parameters.
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::consts::{constant_simple, Constant};
|
|||
use rustc::hir::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{in_macro, snippet, span_lint, unsext, clip};
|
||||
use rustc::ty;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use rustc::ty;
|
||||
use std::collections::HashSet;
|
||||
use syntax::ast::{Lit, LitKind, Name};
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
use syntax::source_map::{Span, Spanned};
|
||||
use crate::utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, walk_ptrs_ty};
|
||||
|
||||
/// **What it does:** Checks for getting the length of something via `.len()`
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc::hir::def::Def;
|
|||
use rustc::hir::*;
|
||||
use rustc::hir::intravisit::*;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{last_path_segment, span_lint};
|
||||
use syntax::symbol::keywords;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use rustc::ty::subst::Subst;
|
|||
use std::collections::{HashMap, HashSet};
|
||||
use std::iter::{once, Iterator};
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{sugg, sext};
|
||||
use crate::utils::usage::mutated_variables;
|
||||
use crate::consts::{constant, Constant};
|
||||
|
|
|
@ -4,7 +4,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use if_chain::if_chain;
|
||||
use rustc::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{in_macro, iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then};
|
||||
use crate::utils::paths;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc::ty::{self, Ty};
|
|||
use std::cmp::Ordering;
|
||||
use std::collections::Bound;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{expr_block, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg,
|
||||
remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty};
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::borrow::Cow;
|
|||
use std::fmt;
|
||||
use std::iter;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::{Span, BytePos};
|
||||
use syntax::source_map::{Span, BytePos};
|
||||
use crate::utils::{get_arg_name, get_trait_def_id, implements_trait, in_macro, is_copy, is_expn_of, is_self,
|
||||
is_self_ty, iter_input_pats, last_path_segment, match_def_path, match_path, match_qpath, match_trait_method,
|
||||
match_type, method_chain_args, match_var, return_ty, remove_blocks, same_tys, single_segment_path, snippet,
|
||||
|
@ -1311,7 +1311,7 @@ fn lint_unnecessary_fold(cx: &LateContext<'_, '_>, expr: &hir::Expr, fold_args:
|
|||
|
||||
then {
|
||||
// Span containing `.fold(...)`
|
||||
let next_point = cx.sess().codemap().next_point(fold_args[0].span);
|
||||
let next_point = cx.sess().source_map().next_point(fold_args[0].span);
|
||||
let fold_span = next_point.with_hi(fold_args[2].span.hi() + BytePos(1));
|
||||
|
||||
let sugg = if replacement_has_args {
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use rustc::ty;
|
||||
use syntax::codemap::{ExpnFormat, Span};
|
||||
use syntax::source_map::{ExpnFormat, Span};
|
||||
use crate::utils::{get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal,
|
||||
iter_input_pats, last_path_segment, match_qpath, match_trait_method, paths, snippet, span_lint,
|
||||
span_lint_and_then, walk_ptrs_ty, SpanlessEq};
|
||||
|
|
|
@ -4,7 +4,7 @@ use if_chain::if_chain;
|
|||
use std::collections::HashMap;
|
||||
use std::char;
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::visit::FnKind;
|
||||
use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then};
|
||||
|
||||
|
@ -235,7 +235,7 @@ impl EarlyLintPass for MiscEarly {
|
|||
for field in pfields {
|
||||
match field.node.pat.node {
|
||||
PatKind::Wild => {},
|
||||
_ => if let Ok(n) = cx.sess().codemap().span_to_snippet(field.span) {
|
||||
_ => if let Ok(n) = cx.sess().source_map().span_to_snippet(field.span) {
|
||||
normal.push(n);
|
||||
},
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use rustc::ty;
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::in_macro;
|
||||
|
||||
/// **What it does:** Warns if there is missing doc for any documentable item
|
||||
|
|
|
@ -13,7 +13,7 @@ use rustc::hir;
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** it lints if an exported function, method, trait method with default impl,
|
||||
/// or trait method impl is not `#[inline]`.
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use rustc::hir::*;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::codemap::Spanned;
|
||||
use syntax::source_map::Spanned;
|
||||
use crate::utils::{snippet, span_lint, span_lint_and_sugg};
|
||||
use crate::utils::sugg::Sugg;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast;
|
||||
use syntax::codemap::{original_sp, DUMMY_SP};
|
||||
use syntax::source_map::{original_sp, DUMMY_SP};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::utils::{in_macro, snippet, snippet_block, span_help_and_lint, trim_multiline};
|
||||
|
|
|
@ -2,7 +2,7 @@ use rustc::hir::*;
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
use syntax::source_map::{Span, Spanned};
|
||||
|
||||
use crate::consts::{self, Constant};
|
||||
use crate::utils::span_lint;
|
||||
|
|
|
@ -4,7 +4,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use rustc::ty::{self, Ty};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_and_then};
|
||||
use crate::utils::sugg::DiagnosticBuilderExt;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use syntax::ast::*;
|
||||
use syntax::attr;
|
||||
|
|
|
@ -2,7 +2,7 @@ use rustc::hir::{Expr, ExprKind};
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
use syntax::source_map::{Span, Spanned};
|
||||
use crate::utils::{match_type, paths, span_lint, walk_ptrs_ty};
|
||||
|
||||
/// **What it does:** Checks for duplicate open options as well as combinations
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::Spanned;
|
||||
use syntax::source_map::Spanned;
|
||||
use crate::utils::{in_macro, snippet, span_lint_and_sugg};
|
||||
|
||||
/// **What it does:** Checks for operations where precedence may be unclear
|
||||
|
|
|
@ -9,7 +9,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use if_chain::if_chain;
|
||||
use rustc::ty;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::MultiSpan;
|
||||
use crate::utils::{match_qpath, match_type, paths, snippet_opt, span_lint, span_lint_and_then, walk_ptrs_hir_ty};
|
||||
use crate::utils::ptr::get_spans;
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use syntax::ast::RangeLimits;
|
||||
use syntax::codemap::Spanned;
|
||||
use syntax::source_map::Spanned;
|
||||
use crate::utils::{is_integer_literal, paths, snippet, span_lint, span_lint_and_then};
|
||||
use crate::utils::{get_trait_def_id, higher, implements_trait, SpanlessEq};
|
||||
use crate::utils::sugg::Sugg;
|
||||
|
|
|
@ -5,7 +5,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use if_chain::if_chain;
|
||||
use std::collections::HashSet;
|
||||
use syntax::ast::{LitKind, NodeId, StrStyle};
|
||||
use syntax::codemap::{BytePos, Span};
|
||||
use syntax::source_map::{BytePos, Span};
|
||||
use crate::utils::{is_expn_of, match_def_path, match_type, opt_def_id, paths, span_help_and_lint, span_lint};
|
||||
use crate::consts::{constant, Constant};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::visit::FnKind;
|
||||
|
||||
use crate::utils::{in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint};
|
||||
|
|
|
@ -4,7 +4,7 @@ use rustc::{declare_lint, lint_array};
|
|||
use rustc::hir::*;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::ty;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{contains_name, higher, iter_input_pats, snippet, span_lint_and_then};
|
||||
|
||||
/// **What it does:** Checks for bindings that shadow other bindings already in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::hir::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::codemap::Spanned;
|
||||
use syntax::source_map::Spanned;
|
||||
use crate::utils::SpanlessEq;
|
||||
use crate::utils::{get_parent_expr, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty};
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::cmp::Ordering;
|
|||
use std::collections::BTreeMap;
|
||||
use std::borrow::Cow;
|
||||
use syntax::ast::{FloatTy, IntTy, UintTy};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use crate::utils::{comparisons, differing_macro_contexts, higher, in_constant, in_macro, last_path_segment, match_def_path, match_path,
|
||||
match_type, multispan_sugg, opt_def_id, same_tys, snippet, snippet_opt, span_help_and_lint, span_lint,
|
||||
|
|
|
@ -2,7 +2,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use rustc::hir::*;
|
||||
use syntax::ast::{LitKind, NodeId};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use unicode_normalization::UnicodeNormalization;
|
||||
use crate::utils::{is_allowed, snippet, span_help_and_lint};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::{declare_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use crate::utils::span_lint;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use rustc::hir;
|
|||
use rustc::hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor};
|
||||
use std::collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use crate::utils::{in_macro, span_lint};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::utils::{in_macro, match_type, paths, span_lint_and_then, usage::is_po
|
|||
use rustc::hir::intravisit::*;
|
||||
use rustc::hir::*;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for calls of `unwrap[_err]()` that cannot fail.
|
||||
///
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
use lazy_static::lazy_static;
|
||||
use std::{env, fmt, fs, io, path};
|
||||
use std::io::Read;
|
||||
use syntax::{ast, codemap};
|
||||
use syntax::{ast, source_map};
|
||||
use toml;
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// Get the configuration file from arguments.
|
||||
pub fn file_from_args(
|
||||
args: &[codemap::Spanned<ast::NestedMetaItemKind>],
|
||||
) -> Result<Option<path::PathBuf>, (&'static str, codemap::Span)> {
|
||||
args: &[source_map::Spanned<ast::NestedMetaItemKind>],
|
||||
) -> Result<Option<path::PathBuf>, (&'static str, source_map::Span)> {
|
||||
for arg in args.iter().filter_map(|a| a.meta_item()) {
|
||||
if arg.name() == "conf_file" {
|
||||
return match arg.node {
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use crate::utils::{match_qpath, paths, span_lint, span_lint_and_sugg};
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::str::FromStr;
|
|||
use std::rc::Rc;
|
||||
use syntax::ast::{self, LitKind};
|
||||
use syntax::attr;
|
||||
use syntax::codemap::{Span, DUMMY_SP};
|
||||
use syntax::source_map::{Span, DUMMY_SP};
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use syntax::ptr::P;
|
||||
use syntax::symbol::keywords;
|
||||
|
@ -365,7 +365,7 @@ pub fn snippet<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'a str)
|
|||
|
||||
/// Convert a span to a code snippet. Returns `None` if not available.
|
||||
pub fn snippet_opt<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Option<String> {
|
||||
cx.sess().codemap().span_to_snippet(span).ok()
|
||||
cx.sess().source_map().span_to_snippet(span).ok()
|
||||
}
|
||||
|
||||
/// Convert a span (from a block) to a code snippet if available, otherwise use
|
||||
|
@ -385,7 +385,7 @@ pub fn snippet_block<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'
|
|||
|
||||
/// Returns a new Span that covers the full last line of the given Span
|
||||
pub fn last_line_of_span<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Span {
|
||||
let file_map_and_line = cx.sess().codemap().lookup_line(span.lo()).unwrap();
|
||||
let file_map_and_line = cx.sess().source_map().lookup_line(span.lo()).unwrap();
|
||||
let line_no = file_map_and_line.line;
|
||||
let line_start = &file_map_and_line.fm.lines[line_no];
|
||||
Span::new(*line_start, span.hi(), span.ctxt())
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::hir::*;
|
|||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::lint::LateContext;
|
||||
use syntax::ast::Name;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{get_pat_name, match_var, snippet};
|
||||
|
||||
pub fn get_spans(
|
||||
|
|
|
@ -10,7 +10,7 @@ use rustc_errors;
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::Display;
|
||||
use std;
|
||||
use syntax::codemap::{CharPos, Span};
|
||||
use syntax::source_map::{CharPos, Span};
|
||||
use syntax::parse::token;
|
||||
use syntax::print::pprust::token_to_string;
|
||||
use syntax::util::parser::AssocOp;
|
||||
|
@ -432,7 +432,7 @@ fn astbinop2assignop(op: ast::BinOp) -> AssocOp {
|
|||
/// Return the indentation before `span` if there are nothing but `[ \t]`
|
||||
/// before it on its line.
|
||||
fn indentation<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Option<String> {
|
||||
let lo = cx.sess().codemap().lookup_char_pos(span.lo());
|
||||
let lo = cx.sess().source_map().lookup_char_pos(span.lo());
|
||||
if let Some(line) = lo.file
|
||||
.get_line(lo.line - 1 /* line numbers in `Loc` are 1-based */)
|
||||
{
|
||||
|
@ -524,8 +524,8 @@ impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for rustc_error
|
|||
|
||||
fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str) {
|
||||
let mut remove_span = item;
|
||||
let hi = cx.sess().codemap().next_point(remove_span).hi();
|
||||
let fmpos = cx.sess().codemap().lookup_byte_offset(hi);
|
||||
let hi = cx.sess().source_map().next_point(remove_span).hi();
|
||||
let fmpos = cx.sess().source_map().lookup_byte_offset(hi);
|
||||
|
||||
if let Some(ref src) = fmpos.fm.src {
|
||||
let non_whitespace_offset = src[fmpos.pos.to_usize()..].find(|c| c != ' ' && c != '\t' && c != '\n');
|
||||
|
|
|
@ -8,7 +8,7 @@ use rustc::middle::mem_categorization::Categorization;
|
|||
use rustc::ty;
|
||||
use std::collections::HashSet;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// Returns a set of mutated local variable ids or None if mutations could not be determined.
|
||||
pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<HashSet<NodeId>> {
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::lint::*;
|
|||
use rustc::{declare_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use rustc::ty::{self, Ty};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{higher, is_copy, snippet, span_lint_and_sugg};
|
||||
use crate::consts::constant;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::collections::Bound;
|
|||
#[test]
|
||||
fn test_overlapping() {
|
||||
use clippy_lints::matches::overlapping;
|
||||
use syntax::codemap::DUMMY_SP;
|
||||
use syntax::source_map::DUMMY_SP;
|
||||
|
||||
let sp = |s, e| clippy_lints::matches::SpannedRange {
|
||||
span: DUMMY_SP,
|
||||
|
|
Loading…
Reference in a new issue