Skip to content

Commit

Permalink
Auto merge of rust-lang#117507 - nnethercote:rustc_span, r=Nilstrieb
Browse files Browse the repository at this point in the history
`rustc_span` cleanups

Just some things I found while looking over this crate.

r? `@oli-obk`
  • Loading branch information
bors committed Nov 3, 2023
2 parents 77c1e3a + e1ec2d5 commit 2d9af16
Show file tree
Hide file tree
Showing 68 changed files with 74 additions and 94 deletions.
3 changes: 1 addition & 2 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, Level,
use rustc_middle::lint::in_external_macro;
use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
use rustc_span::symbol::Symbol;
use rustc_span::{sym, DUMMY_SP};
use rustc_span::{sym, DUMMY_SP, Span};
use semver::Version;

static UNIX_SYSTEMS: &[&str] = &[
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, UnOp};
use rustc_lint::{LateContext, LateLintPass, Level};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

declare_clippy_lint! {
/// ### What it does
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cargo/common_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use cargo_metadata::Metadata;
use clippy_utils::diagnostics::span_lint;
use rustc_lint::LateContext;
use rustc_span::source_map::DUMMY_SP;
use rustc_span::DUMMY_SP;

use super::CARGO_COMMON_METADATA;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cargo/feature_name.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cargo_metadata::Metadata;
use clippy_utils::diagnostics::span_lint_and_help;
use rustc_lint::LateContext;
use rustc_span::source_map::DUMMY_SP;
use rustc_span::DUMMY_SP;

use super::{NEGATIVE_FEATURE_NAMES, REDUNDANT_FEATURE_NAMES};

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cargo/multiple_crate_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use if_chain::if_chain;
use itertools::Itertools;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_lint::LateContext;
use rustc_span::source_map::DUMMY_SP;
use rustc_span::DUMMY_SP;

use super::MULTIPLE_CRATE_VERSIONS;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cargo/wildcard_dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cargo_metadata::Metadata;
use clippy_utils::diagnostics::span_lint;
use if_chain::if_chain;
use rustc_lint::LateContext;
use rustc_span::source_map::DUMMY_SP;
use rustc_span::DUMMY_SP;

use super::WILDCARD_DEPENDENCIES;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/cognitive_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use rustc_hir::{Body, Expr, ExprKind, FnDecl};
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Span;
use rustc_span::{sym, BytePos};
use rustc_span::{sym, BytePos, Span};

declare_clippy_lint! {
/// ### What it does
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use rustc_middle::ty::{
};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

declare_clippy_lint! {
/// ### What it does
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use rustc_resolve::rustdoc::{
use rustc_session::parse::ParseSess;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::edition::Edition;
use rustc_span::source_map::{BytePos, FilePathMapping, SourceMap, Span};
use rustc_span::{sym, FileName, Pos};
use rustc_span::{sym, BytePos, FileName, Pos, Span};
use rustc_span::source_map::{FilePathMapping, SourceMap};
use std::ops::Range;
use std::{io, thread};
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, TraitRef, Ty};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::kw;
use rustc_target::spec::abi::Abi;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind, UnOp};
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
use rustc_span::Span;

declare_clippy_lint! {
/// ### What it does
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/implicit_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{Ty, TypeckResults};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::sym;

use if_chain::if_chain;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/item_name_repetitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use clippy_utils::str_utils::{camel_case_split, count_match_end, count_match_sta
use rustc_hir::{EnumDef, FieldDef, Item, ItemKind, OwnerId, Variant, VariantData};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::Symbol;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/large_enum_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::lint::in_external_macro;
use rustc_middle::ty::{Adt, Ty};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
use rustc_span::Span;

declare_clippy_lint! {
/// ### What it does
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/len_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use rustc_hir::{
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{self, AssocKind, FnSig, Ty};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::{Span, Spanned, Symbol};
use rustc_span::{Span, Symbol};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::sym;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_middle::hir::nested_filter as middle_nested_filter;
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::{kw, Ident, Symbol};

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops/manual_find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_hir::def::Res;
use rustc_hir::lang_items::LangItem;
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Node, Pat, PatKind, Stmt, StmtKind};
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::Span;

pub(super) fn check<'tcx>(
cx: &LateContext<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops/manual_flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_hir::def::{DefKind, Res};
use rustc_hir::{Expr, Pat, PatKind};
use rustc_lint::LateContext;
use rustc_middle::ty;
use rustc_span::source_map::Span;
use rustc_span::Span;

/// Check for unnecessary `if let` usage in a for loop where only the `Some` or `Ok` variant of the
/// iterator element is used.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use clippy_utils::higher;
use rustc_hir::{Expr, ExprKind, LoopSource, Pat};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
use rustc_span::Span;
use utils::{make_iterator_snippet, IncrementVisitor, InitializeVisitor};

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops/mut_range_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::LateContext;
use rustc_middle::mir::FakeReadCause;
use rustc_middle::ty;
use rustc_span::source_map::Span;
use rustc_span::Span;

pub(super) fn check(cx: &LateContext<'_>, arg: &Expr<'_>, body: &Expr<'_>) {
if_chain! {
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/map_unit_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use rustc_hir as hir;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{self, Ty};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

declare_clippy_lint! {
/// ### What it does
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/mem_replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::sym;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/expect_fun_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_middle::ty;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::sym;
use std::borrow::Cow;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/filetype_is_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use clippy_utils::ty::is_type_diagnostic_item;
use if_chain::if_chain;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::FILETYPE_IS_FILE;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/filter_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_hir::def::Res;
use rustc_hir::{Closure, Expr, ExprKind, PatKind, PathSegment, QPath, UnOp};
use rustc_lint::LateContext;
use rustc_middle::ty::adjustment::Adjust;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::{sym, Ident, Symbol};
use std::borrow::Cow;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/filter_map_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use clippy_utils::{is_expr_untyped_identity_function, is_trait_method};
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::FILTER_MAP_IDENTITY;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/flat_map_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use clippy_utils::{is_expr_untyped_identity_function, is_trait_method};
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::FLAT_MAP_IDENTITY;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/flat_map_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_middle::ty;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::FLAT_MAP_OPTION;
use clippy_utils::ty::is_type_diagnostic_item;
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/inspect_for_each.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::is_trait_method;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::INSPECT_FOR_EACH;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/into_iter_on_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_middle::ty::{self, Ty};
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::{sym, Symbol};

use super::INTO_ITER_ON_REF;
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/map_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use clippy_utils::{is_expr_untyped_identity_function, is_trait_method};
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::MAP_IDENTITY;

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/open_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use clippy_utils::ty::is_type_diagnostic_item;
use rustc_ast::ast::LitKind;
use rustc_hir::{Expr, ExprKind};
use rustc_lint::LateContext;
use rustc_span::source_map::{Span, Spanned};
use rustc_span::sym;
use rustc_span::source_map::Spanned;
use rustc_span::{sym, Span};

use super::NONSENSICAL_OPEN_OPTIONS;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/option_map_unwrap_or.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use rustc_hir::intravisit::{walk_path, Visitor};
use rustc_hir::{self, ExprKind, HirId, Node, PatKind, Path, QPath};
use rustc_lint::LateContext;
use rustc_middle::hir::nested_filter;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::MAP_UNWRAP_OR;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/or_fun_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_lint::LateContext;
use rustc_middle::ty;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::{self, sym, Symbol};
use {rustc_ast as ast, rustc_hir as hir};

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/search_is_some.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_hir::PatKind;
use rustc_lint::LateContext;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_span::symbol::sym;

use super::SEARCH_IS_SOME;
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/unnecessary_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use rustc_hir as hir;
use rustc_hir::PatKind;
use rustc_lint::LateContext;
use rustc_middle::ty;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

use super::UNNECESSARY_FOLD;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/wrong_self_convention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::ty::is_copy;
use rustc_lint::LateContext;
use rustc_middle::ty::Ty;
use rustc_span::source_map::Span;
use rustc_span::Span;
use std::fmt;

use super::WRONG_SELF_CONVENTION;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Span;
use rustc_span::Span;

use crate::ref_patterns::REF_PATTERNS;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/misc_early/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
use rustc_span::Span;

declare_clippy_lint! {
/// ### What it does
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/misc_early/unneeded_wildcard_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
use rustc_ast::ast::{Pat, PatKind};
use rustc_errors::Applicability;
use rustc_lint::EarlyContext;
use rustc_span::source_map::Span;
use rustc_span::Span;

use super::UNNEEDED_WILDCARD_PATTERN;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/missing_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::ty::Visibility;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::def_id::CRATE_DEF_ID;
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

declare_clippy_lint! {
/// ### What it does
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/missing_inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use rustc_ast::ast;
use rustc_hir as hir;
use rustc_lint::{self, LateContext, LateLintPass, LintContext};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::{sym, Span};

declare_clippy_lint! {
/// ### What it does
Expand Down
Loading

0 comments on commit 2d9af16

Please sign in to comment.