Reintroduce extern crate for non-Cargo dependencies.
This commit is contained in:
parent
4aaef72fa0
commit
9219fc6c5c
130 changed files with 723 additions and 695 deletions
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
#![allow(clippy::print_stdout, clippy::use_debug)]
|
||||
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc::hir;
|
||||
use rustc::hir::{Expr, ExprKind, QPath, TyKind, Pat, PatKind, BindingAnnotation, StmtKind, DeclKind, Stmt};
|
||||
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::{Expr, ExprKind, QPath, TyKind, Pat, PatKind, BindingAnnotation, StmtKind, DeclKind, Stmt};
|
||||
use crate::rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||
use crate::rustc_data_structures::fx::FxHashMap;
|
||||
use crate::syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID};
|
||||
use crate::utils::get_attr;
|
||||
|
||||
/// **What it does:** Generates clippy code that detects the offending pattern
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#![deny(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use rustc::hir::{BinOpKind, Expr};
|
||||
use crate::rustc::hir::{BinOpKind, Expr};
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
/// Represent a normalized comparison operator.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use lazy_static::lazy_static;
|
|||
use std::default::Default;
|
||||
use std::{env, fmt, fs, io, path};
|
||||
use std::io::Read;
|
||||
use syntax::{ast, source_map};
|
||||
use crate::syntax::{ast, source_map};
|
||||
use toml;
|
||||
use std::sync::Mutex;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#![deny(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use if_chain::if_chain;
|
||||
use rustc::{hir, ty};
|
||||
use rustc::lint::LateContext;
|
||||
use syntax::ast;
|
||||
use crate::rustc::{hir, ty};
|
||||
use crate::rustc::lint::LateContext;
|
||||
use crate::syntax::ast;
|
||||
use crate::utils::{is_expn_of, match_def_path, match_qpath, opt_def_id, paths, resolve_node};
|
||||
|
||||
/// Convert a hir binary operator to the corresponding `ast` type.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use crate::consts::{constant_simple, constant_context};
|
||||
use rustc::lint::LateContext;
|
||||
use rustc::hir::*;
|
||||
use rustc::ty::{TypeckTables};
|
||||
use crate::rustc::lint::LateContext;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::ty::{TypeckTables};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use syntax::ast::Name;
|
||||
use syntax::ptr::P;
|
||||
use crate::syntax::ast::Name;
|
||||
use crate::syntax::ptr::P;
|
||||
use crate::utils::differing_macro_contexts;
|
||||
|
||||
/// Type used to check whether two ast are the same. This is different from the
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
//! checks for attributes
|
||||
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc::hir;
|
||||
use rustc::hir::print;
|
||||
use syntax::ast::Attribute;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::print;
|
||||
use crate::syntax::ast::Attribute;
|
||||
use crate::utils::get_attr;
|
||||
|
||||
/// **What it does:** Dumps every ast/hir node which has the `#[clippy_dump]`
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, EarlyContext, EarlyLintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc::hir::*;
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, EarlyContext, EarlyLintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
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::source_map::Span;
|
||||
use crate::syntax::symbol::LocalInternedString;
|
||||
use crate::syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name};
|
||||
use crate::syntax::source_map::Span;
|
||||
|
||||
|
||||
/// **What it does:** Checks for various things we like to keep tidy in clippy.
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
use crate::reexport::*;
|
||||
use matches::matches;
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::hir::*;
|
||||
use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX};
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||
use rustc::hir::Node;
|
||||
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
||||
use rustc::session::Session;
|
||||
use rustc::traits;
|
||||
use rustc::ty::{self, Binder, Ty, TyCtxt, layout::{self, IntegerExt}, subst::Kind};
|
||||
use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::hir::def_id::{DefId, CRATE_DEF_INDEX};
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||
use crate::rustc::hir::Node;
|
||||
use crate::rustc::lint::{LateContext, Level, Lint, LintContext};
|
||||
use crate::rustc::session::Session;
|
||||
use crate::rustc::traits;
|
||||
use crate::rustc::ty::{self, Binder, Ty, TyCtxt, layout::{self, IntegerExt}, subst::Kind};
|
||||
use crate::rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
|
||||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
use std::mem;
|
||||
use std::str::FromStr;
|
||||
use std::rc::Rc;
|
||||
use syntax::ast::{self, LitKind};
|
||||
use syntax::attr;
|
||||
use syntax::source_map::{Span, DUMMY_SP};
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use syntax::symbol::keywords;
|
||||
use crate::syntax::ast::{self, LitKind};
|
||||
use crate::syntax::attr;
|
||||
use crate::syntax::source_map::{Span, DUMMY_SP};
|
||||
use crate::syntax::errors::DiagnosticBuilder;
|
||||
use crate::syntax::symbol::keywords;
|
||||
|
||||
mod camel_case;
|
||||
pub use self::camel_case::{camel_case_from, camel_case_until};
|
||||
|
|
@ -70,7 +70,7 @@ pub fn in_macro(span: Span) -> bool {
|
|||
///
|
||||
/// See also the `paths` module.
|
||||
pub fn match_def_path(tcx: TyCtxt<'_, '_, '_>, def_id: DefId, path: &[&str]) -> bool {
|
||||
use syntax::symbol;
|
||||
use crate::syntax::symbol;
|
||||
|
||||
struct AbsolutePathBuffer {
|
||||
names: Vec<symbol::LocalInternedString>,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::borrow::Cow;
|
||||
use rustc::hir::*;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::lint::LateContext;
|
||||
use syntax::ast::Name;
|
||||
use syntax::source_map::Span;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use crate::rustc::lint::LateContext;
|
||||
use crate::syntax::ast::Name;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::{get_pat_name, match_var, snippet};
|
||||
|
||||
pub fn get_spans(
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
#![deny(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use matches::matches;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{EarlyContext, LateContext, LintContext};
|
||||
use rustc_errors;
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::lint::{EarlyContext, LateContext, LintContext};
|
||||
use crate::rustc_errors;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Display;
|
||||
use std;
|
||||
use syntax::source_map::{CharPos, Span};
|
||||
use syntax::parse::token;
|
||||
use syntax::print::pprust::token_to_string;
|
||||
use syntax::util::parser::AssocOp;
|
||||
use syntax::ast;
|
||||
use crate::syntax::source_map::{CharPos, Span};
|
||||
use crate::syntax::parse::token;
|
||||
use crate::syntax::print::pprust::token_to_string;
|
||||
use crate::syntax::util::parser::AssocOp;
|
||||
use crate::syntax::ast;
|
||||
use crate::utils::{higher, snippet, snippet_opt};
|
||||
use syntax_pos::{BytePos, Pos};
|
||||
use crate::syntax_pos::{BytePos, Pos};
|
||||
|
||||
/// A helper type to build suggestion correctly handling parenthesis.
|
||||
pub enum Sugg<'a> {
|
||||
|
|
@ -86,7 +86,7 @@ impl<'a> Sugg<'a> {
|
|||
|
||||
/// Prepare a suggestion from an expression.
|
||||
pub fn ast(cx: &EarlyContext<'_>, expr: &ast::Expr, default: &'a str) -> Self {
|
||||
use syntax::ast::RangeLimits;
|
||||
use crate::syntax::ast::RangeLimits;
|
||||
|
||||
let snippet = snippet(cx, expr.span, default);
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ enum Associativity {
|
|||
/// they are considered
|
||||
/// associative.
|
||||
fn associativity(op: &AssocOp) -> Associativity {
|
||||
use syntax::util::parser::AssocOp::*;
|
||||
use crate::syntax::util::parser::AssocOp::*;
|
||||
|
||||
match *op {
|
||||
ObsoleteInPlace | Assign | AssignOp(_) => Associativity::Right,
|
||||
|
|
@ -382,7 +382,7 @@ fn associativity(op: &AssocOp) -> Associativity {
|
|||
|
||||
/// Convert a `hir::BinOp` to the corresponding assigning binary operator.
|
||||
fn hirbinop2assignop(op: hir::BinOp) -> AssocOp {
|
||||
use syntax::parse::token::BinOpToken::*;
|
||||
use crate::syntax::parse::token::BinOpToken::*;
|
||||
|
||||
AssocOp::AssignOp(match op.node {
|
||||
hir::BinOpKind::Add => Plus,
|
||||
|
|
@ -410,8 +410,8 @@ fn hirbinop2assignop(op: hir::BinOp) -> AssocOp {
|
|||
|
||||
/// Convert an `ast::BinOp` to the corresponding assigning binary operator.
|
||||
fn astbinop2assignop(op: ast::BinOp) -> AssocOp {
|
||||
use syntax::ast::BinOpKind::*;
|
||||
use syntax::parse::token::BinOpToken;
|
||||
use crate::syntax::ast::BinOpKind::*;
|
||||
use crate::syntax::parse::token::BinOpToken;
|
||||
|
||||
AssocOp::AssignOp(match op.node {
|
||||
Add => BinOpToken::Plus,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use rustc::lint::LateContext;
|
||||
use crate::rustc::lint::LateContext;
|
||||
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::*;
|
||||
use rustc::middle::expr_use_visitor::*;
|
||||
use rustc::middle::mem_categorization::cmt_;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
use rustc::ty;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::source_map::Span;
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::middle::expr_use_visitor::*;
|
||||
use crate::rustc::middle::mem_categorization::cmt_;
|
||||
use crate::rustc::middle::mem_categorization::Categorization;
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc_data_structures::fx::FxHashSet;
|
||||
use crate::syntax::ast::NodeId;
|
||||
use crate::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<FxHashSet<NodeId>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue