From 76321d3300e0047351fafdfd8e93a15b5a0c1065 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 19 Aug 2018 19:06:53 -0700 Subject: [PATCH 1/2] codemap -> source_map https://github.com/rust-lang/rust/pull/52953 --- clippy_lints/src/arithmetic.rs | 2 +- clippy_lints/src/attrs.rs | 2 +- clippy_lints/src/bit_mask.rs | 2 +- clippy_lints/src/booleans.rs | 2 +- clippy_lints/src/cyclomatic_complexity.rs | 2 +- clippy_lints/src/derive.rs | 2 +- clippy_lints/src/doc.rs | 2 +- clippy_lints/src/double_comparison.rs | 2 +- clippy_lints/src/duration_subsec.rs | 2 +- clippy_lints/src/entry.rs | 2 +- clippy_lints/src/enum_glob_use.rs | 2 +- clippy_lints/src/enum_variants.rs | 2 +- clippy_lints/src/erasing_op.rs | 2 +- clippy_lints/src/escape.rs | 2 +- clippy_lints/src/functions.rs | 2 +- clippy_lints/src/identity_op.rs | 2 +- clippy_lints/src/len_zero.rs | 2 +- clippy_lints/src/lifetimes.rs | 2 +- clippy_lints/src/loops.rs | 2 +- clippy_lints/src/map_unit_fn.rs | 2 +- clippy_lints/src/matches.rs | 2 +- clippy_lints/src/methods.rs | 4 ++-- clippy_lints/src/misc.rs | 2 +- clippy_lints/src/misc_early.rs | 4 ++-- clippy_lints/src/missing_doc.rs | 2 +- clippy_lints/src/missing_inline.rs | 2 +- clippy_lints/src/needless_bool.rs | 2 +- clippy_lints/src/needless_continue.rs | 2 +- clippy_lints/src/neg_multiply.rs | 2 +- clippy_lints/src/new_without_default.rs | 2 +- clippy_lints/src/non_expressive_names.rs | 2 +- clippy_lints/src/open_options.rs | 2 +- clippy_lints/src/precedence.rs | 2 +- clippy_lints/src/ptr.rs | 2 +- clippy_lints/src/ranges.rs | 2 +- clippy_lints/src/regex.rs | 2 +- clippy_lints/src/returns.rs | 2 +- clippy_lints/src/shadow.rs | 2 +- clippy_lints/src/strings.rs | 2 +- clippy_lints/src/types.rs | 2 +- clippy_lints/src/unicode.rs | 2 +- clippy_lints/src/unsafe_removed_from_name.rs | 2 +- clippy_lints/src/unused_label.rs | 2 +- clippy_lints/src/unwrap.rs | 2 +- clippy_lints/src/utils/conf.rs | 6 +++--- clippy_lints/src/utils/internal_lints.rs | 2 +- clippy_lints/src/utils/mod.rs | 6 +++--- clippy_lints/src/utils/ptr.rs | 2 +- clippy_lints/src/utils/sugg.rs | 8 ++++---- clippy_lints/src/utils/usage.rs | 2 +- clippy_lints/src/vec.rs | 2 +- tests/matches.rs | 2 +- 52 files changed, 61 insertions(+), 61 deletions(-) diff --git a/clippy_lints/src/arithmetic.rs b/clippy_lints/src/arithmetic.rs index b3d78d2d13f7..90f72d3d1842 100644 --- a/clippy_lints/src/arithmetic.rs +++ b/clippy_lints/src/arithmetic.rs @@ -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. /// diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 3d25f524afd8..9804d3a0f077 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -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. diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index 249ebbde2f79..12de4faa753c 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -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}; diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index ef6f71f68319..eda6a045cba4 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -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}; diff --git a/clippy_lints/src/cyclomatic_complexity.rs b/clippy_lints/src/cyclomatic_complexity.rs index d66e6f2849bb..67cd37bee370 100644 --- a/clippy_lints/src/cyclomatic_complexity.rs +++ b/clippy_lints/src/cyclomatic_complexity.rs @@ -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}; diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index 0689ef25c207..5aeca29f6d8c 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -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}; diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 2b11e8fa77d4..12128eda2588 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -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; diff --git a/clippy_lints/src/double_comparison.rs b/clippy_lints/src/double_comparison.rs index 434ccb69921e..013a75e64571 100644 --- a/clippy_lints/src/double_comparison.rs +++ b/clippy_lints/src/double_comparison.rs @@ -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}; diff --git a/clippy_lints/src/duration_subsec.rs b/clippy_lints/src/duration_subsec.rs index 517befa7790f..ef5d18f081a9 100644 --- a/clippy_lints/src/duration_subsec.rs +++ b/clippy_lints/src/duration_subsec.rs @@ -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; diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 26ee6be5796b..142a099f5399 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -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}; diff --git a/clippy_lints/src/enum_glob_use.rs b/clippy_lints/src/enum_glob_use.rs index 6f8afc710de6..90cc1716cc1b 100644 --- a/clippy_lints/src/enum_glob_use.rs +++ b/clippy_lints/src/enum_glob_use.rs @@ -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::*`. diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index 16c9212e5db8..ca38d497df46 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -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}; diff --git a/clippy_lints/src/erasing_op.rs b/clippy_lints/src/erasing_op.rs index 4960a48b3c88..2976700428cb 100644 --- a/clippy_lints/src/erasing_op.rs +++ b/clippy_lints/src/erasing_op.rs @@ -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`. diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index ebbc2c34811b..2cd2a46cbabe 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -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 { diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 8903766c330b..b86e33321889 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -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. diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index 8a58f2681d6e..939039e93ca7 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -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; diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 081450516bb3..ce0635188802 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -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()` diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index cf7a016231e3..d8e6a43f864f 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -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; diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 6d3134d22062..3dacb3cd422b 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -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}; diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index 6ccf8daa71d6..7cbed82d5c7e 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -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; diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index d42355f89f4b..84ab72777e43 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -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}; diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index 69df7f2a1c5a..ceb1307dfed4 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -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 { diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index b01d24a1ad33..fc9b72ba949c 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -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}; diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index 9b8e0743f393..6c82fa58e8df 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -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); }, } diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index fe2bbbdb9af0..9735799d136b 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -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 diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index e80a0a1d8c3e..8e2b08b51525 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -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]`. diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index 559aa74f9a22..19d860dab365 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -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; diff --git a/clippy_lints/src/needless_continue.rs b/clippy_lints/src/needless_continue.rs index 60ab0eaae024..0c9b354035f9 100644 --- a/clippy_lints/src/needless_continue.rs +++ b/clippy_lints/src/needless_continue.rs @@ -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}; diff --git a/clippy_lints/src/neg_multiply.rs b/clippy_lints/src/neg_multiply.rs index c056ff46178b..2b0c021ea03d 100644 --- a/clippy_lints/src/neg_multiply.rs +++ b/clippy_lints/src/neg_multiply.rs @@ -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; diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index f731b3764743..77b945f48fd6 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -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; diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 3401fbca1711..acfa341ed1fa 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -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; diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index effeb88d0cf8..ac399e238b69 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -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 diff --git a/clippy_lints/src/precedence.rs b/clippy_lints/src/precedence.rs index 6a0f4f147b72..c4e802adaeec 100644 --- a/clippy_lints/src/precedence.rs +++ b/clippy_lints/src/precedence.rs @@ -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 diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index ea2d07df4557..cbf171381378 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -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; diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index fd303bb6ab4f..27620ede5b0c 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -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; diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index 39b7888dcc60..4553b08e7478 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -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}; diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index b2202fb1effd..8125cc4153ba 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -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}; diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index f04d7bf9867e..f5c25737993d 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -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 diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index a13f864c5ce7..d66163984aa8 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -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}; diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 7b3f6f20fc74..3b311847795c 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -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, diff --git a/clippy_lints/src/unicode.rs b/clippy_lints/src/unicode.rs index 0549e774fb55..2768efca88e1 100644 --- a/clippy_lints/src/unicode.rs +++ b/clippy_lints/src/unicode.rs @@ -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}; diff --git a/clippy_lints/src/unsafe_removed_from_name.rs b/clippy_lints/src/unsafe_removed_from_name.rs index 2f8b3ab836db..37a5836f153d 100644 --- a/clippy_lints/src/unsafe_removed_from_name.rs +++ b/clippy_lints/src/unsafe_removed_from_name.rs @@ -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; diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index 1681a303fd37..04b4fcabdd80 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -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}; diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index 6cafcaeffe97..2a557ed8e436 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -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. /// diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index c1ac058a83e7..1567bd9ffb67 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -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], -) -> Result, (&'static str, codemap::Span)> { + args: &[source_map::Spanned], +) -> Result, (&'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 { diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 260ced14cb43..6df41f1cd41c 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -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}; diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 32a891c8cbbf..0182ae6a1a0b 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -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 { - 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()) diff --git a/clippy_lints/src/utils/ptr.rs b/clippy_lints/src/utils/ptr.rs index 1a20eb010153..16a03f8f99c6 100644 --- a/clippy_lints/src/utils/ptr.rs +++ b/clippy_lints/src/utils/ptr.rs @@ -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( diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 11187559bf6a..d513fb8bced7 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -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 { - 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'); diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs index 43e492bfb4e4..95199b9f208e 100644 --- a/clippy_lints/src/utils/usage.rs +++ b/clippy_lints/src/utils/usage.rs @@ -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> { diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index cea3307a8273..9e0cd06134b7 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -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; diff --git a/tests/matches.rs b/tests/matches.rs index 8dfb8e42d6f0..c79e233cc815 100644 --- a/tests/matches.rs +++ b/tests/matches.rs @@ -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, From a7bea134d30577fa6f1f722cc27e5873c5869962 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 19 Aug 2018 19:07:31 -0700 Subject: [PATCH 2/2] Remove implied rust_2018 feature We are already on the edition and this feature is implied. --- clippy_lints/src/lib.rs | 1 - mini-macro/src/lib.rs | 2 +- src/lib.rs | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 3de7c6de9797..76649d8a1451 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -12,7 +12,6 @@ #![feature(iterator_find_map)] #![feature(macro_at_most_once_rep)] #![feature(tool_attributes)] -#![feature(rust_2018_preview)] #![warn(rust_2018_idioms)] use toml; diff --git a/mini-macro/src/lib.rs b/mini-macro/src/lib.rs index 3417e603c126..8a19dc2c4e58 100644 --- a/mini-macro/src/lib.rs +++ b/mini-macro/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(use_extern_macros, proc_macro_quote, proc_macro_non_items)] +#![feature(proc_macro_quote, proc_macro_non_items)] extern crate proc_macro; use proc_macro::{TokenStream, quote}; diff --git a/src/lib.rs b/src/lib.rs index c2363fef9072..e6aaff1b2a95 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ // error-pattern:cargo-clippy #![feature(plugin_registrar)] -#![feature(rust_2018_preview)] #![feature(rustc_private)] #![feature(macro_vis_matcher)] #![allow(unknown_lints)]