mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Rustup to rust-lang/rust#67707
This commit is contained in:
parent
3036b0e6d5
commit
9086b17e14
@ -15,11 +15,11 @@ use rustc::lint::{
|
||||
use rustc::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use semver::Version;
|
||||
use syntax::ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem};
|
||||
use syntax::source_map::Span;
|
||||
use syntax::util::lev_distance::find_best_match_for_name;
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for items annotated with `#[inline(always)]`,
|
||||
|
@ -5,9 +5,9 @@ use rustc::hir::*;
|
||||
use rustc::impl_lint_pass;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::BytePos;
|
||||
use syntax::ast::Attribute;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::BytePos;
|
||||
|
||||
use crate::utils::{match_type, paths, snippet_opt, span_help_and_lint, LimitStack};
|
||||
|
||||
|
@ -9,12 +9,12 @@ use rustc::ty::subst::{Subst, SubstsRef};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::{bug, span_bug};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use std::cmp::Ordering::{self, Equal};
|
||||
use std::cmp::PartialOrd;
|
||||
use std::convert::TryInto;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use syntax::ast::{FloatTy, LitKind};
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
/// A `LitKind`-like enum to fold constant `Expr`s into.
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -5,10 +5,10 @@ use rustc::impl_lint_pass;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::Pos;
|
||||
use std::ops::Range;
|
||||
use syntax::ast::{AttrKind, Attribute};
|
||||
use syntax::source_map::{BytePos, MultiSpan, Span};
|
||||
use syntax_pos::Pos;
|
||||
use url::Url;
|
||||
|
||||
declare_clippy_lint! {
|
||||
|
@ -7,11 +7,11 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use std::f32;
|
||||
use std::f64;
|
||||
use std::fmt;
|
||||
use syntax::ast::*;
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for float literals with a precision greater
|
||||
|
@ -6,7 +6,7 @@ use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc_session::declare_tool_lint;
|
||||
use syntax_pos::Span;
|
||||
use rustc_span::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()`
|
||||
|
@ -6,7 +6,7 @@ use rustc::impl_lint_pass;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use syntax_pos::Span;
|
||||
use rustc_span::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for multiple inherent implementations of a struct
|
||||
|
@ -36,13 +36,13 @@ extern crate rustc_parse;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate rustc_session;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate rustc_span;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate rustc_target;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate rustc_typeck;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate syntax;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate syntax_pos;
|
||||
|
||||
use rustc::lint::{self, LintId};
|
||||
use rustc::session::Session;
|
||||
|
@ -330,7 +330,7 @@ enum WarningType {
|
||||
}
|
||||
|
||||
impl WarningType {
|
||||
fn display(&self, suggested_format: String, cx: &EarlyContext<'_>, span: syntax_pos::Span) {
|
||||
fn display(&self, suggested_format: String, cx: &EarlyContext<'_>, span: rustc_span::Span) {
|
||||
match self {
|
||||
Self::MistypedLiteralSuffix => span_lint_and_sugg(
|
||||
cx,
|
||||
@ -450,7 +450,7 @@ impl LiteralDigitGrouping {
|
||||
// Returns `false` if the check fails
|
||||
fn check_for_mistyped_suffix(
|
||||
cx: &EarlyContext<'_>,
|
||||
span: syntax_pos::Span,
|
||||
span: rustc_span::Span,
|
||||
num_lit: &mut NumericLiteral<'_>,
|
||||
) -> bool {
|
||||
if num_lit.suffix.is_some() {
|
||||
|
@ -17,12 +17,12 @@ use rustc::ty::subst::Subst;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_span::{BytePos, Symbol};
|
||||
use rustc_typeck::expr_use_visitor::*;
|
||||
use std::iter::{once, Iterator};
|
||||
use std::mem;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::{BytePos, Symbol};
|
||||
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{
|
||||
|
@ -5,8 +5,8 @@ use rustc::hir::{self, *};
|
||||
use rustc::lint::LateContext;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
use super::OPTION_MAP_UNWRAP_OR;
|
||||
|
||||
|
@ -603,7 +603,7 @@ fn is_used(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
|
||||
/// Tests whether an expression is in a macro expansion (e.g., something
|
||||
/// generated by `#[derive(...)]` or the like).
|
||||
fn in_attributes_expansion(expr: &Expr<'_>) -> bool {
|
||||
use syntax_pos::hygiene::MacroKind;
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
if expr.span.from_expansion() {
|
||||
let data = expr.span.ctxt().outer_expn_data();
|
||||
|
||||
|
@ -6,8 +6,8 @@ use rustc::hir::{Body, Constness, FnDecl, HirId};
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc_mir::transform::qualify_min_const_fn::is_min_const_fn;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::Span;
|
||||
use rustc_typeck::hir_ty_to_ty;
|
||||
use syntax_pos::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:**
|
||||
|
@ -6,7 +6,7 @@ use rustc::hir::{BorrowKind, Expr, ExprKind, Mutability, StmtKind, UnOp};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_lint_pass, ty};
|
||||
use rustc_session::declare_tool_lint;
|
||||
use syntax_pos::Span;
|
||||
use rustc_span::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for function/method calls with a mutable
|
||||
|
@ -14,12 +14,12 @@ use rustc::ty::{self, RegionKind, TypeFoldable};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_typeck::expr_use_visitor as euv;
|
||||
use std::borrow::Cow;
|
||||
use syntax::ast::Attribute;
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use syntax_pos::{Span, Symbol};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for functions taking arguments by value, but not
|
||||
|
@ -11,8 +11,8 @@ use rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass};
|
||||
use rustc::ty::adjustment::Adjust;
|
||||
use rustc::ty::{Ty, TypeFlags};
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::{InnerSpan, Span, DUMMY_SP};
|
||||
use rustc_typeck::hir_ty_to_ty;
|
||||
use syntax_pos::{InnerSpan, Span, DUMMY_SP};
|
||||
|
||||
use crate::utils::{in_constant, is_copy, qpath_res, span_lint_and_then};
|
||||
|
||||
|
@ -4,8 +4,8 @@ use rustc::declare_lint_pass;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax_pos::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for missing parameters in `panic!`.
|
||||
|
@ -13,9 +13,9 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::{MultiSpan, Symbol};
|
||||
use std::borrow::Cow;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::{MultiSpan, Symbol};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** This lint checks for function arguments of type `&String`
|
||||
|
@ -3,10 +3,10 @@ use rustc::declare_lint_pass;
|
||||
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::BytePos;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::visit::FnKind;
|
||||
use syntax_pos::BytePos;
|
||||
|
||||
use crate::utils::{match_path_ast, snippet_opt, span_lint_and_then};
|
||||
|
||||
|
@ -7,8 +7,8 @@ use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks slow zero-filled vector initialization
|
||||
|
@ -11,7 +11,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use syntax_pos::Symbol;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for manual swapping.
|
||||
|
@ -12,9 +12,9 @@ use rustc::session::config::Config as SessionConfig;
|
||||
use rustc::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::LayoutOf;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use syntax_pos::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for functions taking arguments by reference, where
|
||||
|
@ -14,13 +14,13 @@ use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables};
|
||||
use rustc::{declare_lint_pass, impl_lint_pass};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_typeck::hir_ty_to_ty;
|
||||
use syntax::ast::{FloatTy, IntTy, LitFloatType, LitIntType, LitKind, UintTy};
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::{sym, Symbol};
|
||||
use syntax_pos::hygiene::{ExpnKind, MacroKind};
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::paths;
|
||||
@ -668,7 +668,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitArg {
|
||||
}
|
||||
|
||||
fn is_questionmark_desugar_marked_call(expr: &Expr<'_>) -> bool {
|
||||
use syntax_pos::hygiene::DesugaringKind;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
if let ExprKind::Call(ref callee, _) = expr.kind {
|
||||
callee.span.is_desugaring(DesugaringKind::QuestionMark)
|
||||
} else {
|
||||
@ -2045,7 +2045,7 @@ declare_lint_pass!(ImplicitHasher => [IMPLICIT_HASHER]);
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
|
||||
#[allow(clippy::cast_possible_truncation, clippy::too_many_lines)]
|
||||
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
|
||||
use syntax_pos::BytePos;
|
||||
use rustc_span::BytePos;
|
||||
|
||||
fn suggestion<'a, 'tcx>(
|
||||
cx: &LateContext<'a, 'tcx>,
|
||||
|
@ -9,7 +9,7 @@ use rustc::ty;
|
||||
use rustc::ty::{DefIdTree, Ty};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use syntax_pos::symbol::kw;
|
||||
use rustc_span::symbol::kw;
|
||||
|
||||
use crate::utils::{differing_macro_contexts, span_lint_and_sugg};
|
||||
|
||||
|
@ -123,7 +123,7 @@ fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'
|
||||
/// Return true if the attributes contain any of `proc_macro`,
|
||||
/// `proc_macro_derive` or `proc_macro_attribute`, false otherwise
|
||||
pub fn is_proc_macro(attrs: &[ast::Attribute]) -> bool {
|
||||
use syntax_pos::Symbol;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
let syms = [
|
||||
Symbol::intern("proc_macro"),
|
||||
|
@ -12,11 +12,11 @@ use rustc::{declare_lint_pass, impl_lint_pass};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::symbol::SymbolStr;
|
||||
use syntax::ast;
|
||||
use syntax::ast::{Crate as AstCrate, ItemKind, Name};
|
||||
use syntax::source_map::Span;
|
||||
use syntax::visit::FnKind;
|
||||
use syntax_pos::symbol::SymbolStr;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for various things we like to keep tidy in clippy.
|
||||
|
@ -40,12 +40,12 @@ use rustc::ty::{
|
||||
Binder, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_span::hygiene::ExpnKind;
|
||||
use smallvec::SmallVec;
|
||||
use syntax::ast::{self, Attribute, LitKind};
|
||||
use syntax::attr;
|
||||
use syntax::source_map::{Span, DUMMY_SP};
|
||||
use syntax::symbol::{kw, Symbol};
|
||||
use syntax_pos::hygiene::ExpnKind;
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::reexport::*;
|
||||
|
@ -104,7 +104,7 @@ pub const STD_CONVERT_IDENTITY: [&str; 3] = ["std", "convert", "identity"];
|
||||
pub const STD_MEM_TRANSMUTE: [&str; 3] = ["std", "mem", "transmute"];
|
||||
pub const STD_PTR_NULL: [&str; 3] = ["std", "ptr", "null"];
|
||||
pub const STRING: [&str; 3] = ["alloc", "string", "String"];
|
||||
pub const SYNTAX_CONTEXT: [&str; 3] = ["syntax_pos", "hygiene", "SyntaxContext"];
|
||||
pub const SYNTAX_CONTEXT: [&str; 3] = ["rustc_span", "hygiene", "SyntaxContext"];
|
||||
pub const TO_OWNED: [&str; 3] = ["alloc", "borrow", "ToOwned"];
|
||||
pub const TO_OWNED_METHOD: [&str; 4] = ["alloc", "borrow", "ToOwned", "to_owned"];
|
||||
pub const TO_STRING: [&str; 3] = ["alloc", "string", "ToString"];
|
||||
|
@ -6,6 +6,7 @@ use matches::matches;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{EarlyContext, LateContext, LintContext};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_span::{BytePos, Pos};
|
||||
use std::borrow::Cow;
|
||||
use std::convert::TryInto;
|
||||
use std::fmt::Display;
|
||||
@ -14,7 +15,6 @@ use syntax::print::pprust::token_kind_to_string;
|
||||
use syntax::source_map::{CharPos, Span};
|
||||
use syntax::token;
|
||||
use syntax::util::parser::AssocOp;
|
||||
use syntax_pos::{BytePos, Pos};
|
||||
|
||||
pub use crate::literal_representation::format_numeric_literal;
|
||||
|
||||
|
@ -8,11 +8,11 @@ use rustc_errors::Applicability;
|
||||
use rustc_lexer::unescape::{self, EscapeError};
|
||||
use rustc_parse::parser;
|
||||
use rustc_session::declare_tool_lint;
|
||||
use rustc_span::{BytePos, Span};
|
||||
use syntax::ast::*;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax::token;
|
||||
use syntax::tokenstream::TokenStream;
|
||||
use syntax_pos::{BytePos, Span};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** This lint warns when you use `println!("")` to
|
||||
|
@ -432,12 +432,12 @@ don't hesitate to ask on Discord, IRC or in the issue/PR.
|
||||
[diagnostics]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/utils/diagnostics.rs
|
||||
[utils]: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/utils/mod.rs
|
||||
[ident]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/symbol/struct.Ident.html
|
||||
[span]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax_pos/struct.Span.html
|
||||
[span]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.Span.html
|
||||
[applicability]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/enum.Applicability.html
|
||||
[if_chain]: https://docs.rs/if_chain/*/if_chain/
|
||||
[ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/sty/index.html
|
||||
[ast]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast/index.html
|
||||
[from_expansion]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax_pos/struct.Span.html#method.from_expansion
|
||||
[from_expansion]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.Span.html#method.from_expansion
|
||||
[in_external_macro]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/fn.in_external_macro.html
|
||||
[play]: https://play.rust-lang.org
|
||||
[author_example]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f093b986e80ad62f3b67a1f24f5e66e2
|
||||
|
Loading…
Reference in New Issue
Block a user