parent
24bb63383a
commit
753c39672e
131 changed files with 589 additions and 2097 deletions
|
@ -4,7 +4,7 @@ use if_chain::if_chain;
|
|||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
|
@ -25,20 +25,9 @@ declare_clippy_lint! {
|
|||
"useless `vec!`"
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Pass;
|
||||
declare_lint_pass!(UselessVec => [USELESS_VEC]);
|
||||
|
||||
impl LintPass for Pass {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(USELESS_VEC)
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"UselessVec"
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessVec {
|
||||
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
|
||||
// search for `&vec![_]` expressions where the adjusted type is `&[_]`
|
||||
if_chain! {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue