Skip to content

Commit f3bb161

Browse files
flip1995Manishearth
authored andcommitted
Adapt codebase to the tool_lints
1 parent cfd4c53 commit f3bb161

25 files changed

+39
-38
lines changed

clippy_lints/src/assign_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
108108
},
109109
hir::ExprKind::Assign(ref assignee, ref e) => {
110110
if let hir::ExprKind::Binary(op, ref l, ref r) = e.node {
111-
#[allow(cyclomatic_complexity)]
111+
#[allow(clippy::cyclomatic_complexity)]
112112
let lint = |assignee: &hir::Expr, rhs: &hir::Expr| {
113113
let ty = cx.tables.expr_ty(assignee);
114114
let rty = cx.tables.expr_ty(rhs);

clippy_lints/src/booleans.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
118118
}
119119
for (n, expr) in self.terminals.iter().enumerate() {
120120
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(e, expr) {
121-
#[allow(cast_possible_truncation)]
121+
#[allow(clippy::cast_possible_truncation)]
122122
return Ok(Bool::Term(n as u8));
123123
}
124124
let negated = match e.node {
@@ -150,14 +150,14 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
150150
_ => continue,
151151
};
152152
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(&negated, expr) {
153-
#[allow(cast_possible_truncation)]
153+
#[allow(clippy::cast_possible_truncation)]
154154
return Ok(Bool::Not(Box::new(Bool::Term(n as u8))));
155155
}
156156
}
157157
let n = self.terminals.len();
158158
self.terminals.push(e);
159159
if n < 32 {
160-
#[allow(cast_possible_truncation)]
160+
#[allow(clippy::cast_possible_truncation)]
161161
Ok(Bool::Term(n as u8))
162162
} else {
163163
Err("too many literals".to_owned())

clippy_lints/src/consts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(cast_possible_truncation)]
2-
#![allow(float_cmp)]
1+
#![allow(clippy::float_cmp)]
32

43
use rustc::lint::LateContext;
54
use rustc::{span_bug, bug};

clippy_lints/src/cyclomatic_complexity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CCHelper<'a, 'tcx> {
186186
}
187187

188188
#[cfg(feature = "debugging")]
189-
#[allow(too_many_arguments)]
189+
#[allow(clippy::too_many_arguments)]
190190
fn report_cc_bug(_: &LateContext<'_, '_>, cc: u64, narms: u64, div: u64, shorts: u64, returns: u64, span: Span, _: NodeId) {
191191
span_bug!(
192192
span,
@@ -200,7 +200,7 @@ fn report_cc_bug(_: &LateContext<'_, '_>, cc: u64, narms: u64, div: u64, shorts:
200200
);
201201
}
202202
#[cfg(not(feature = "debugging"))]
203-
#[allow(too_many_arguments)]
203+
#[allow(clippy::too_many_arguments)]
204204
fn report_cc_bug(cx: &LateContext<'_, '_>, cc: u64, narms: u64, div: u64, shorts: u64, returns: u64, span: Span, id: NodeId) {
205205
if !is_allowed(cx, CYCLOMATIC_COMPLEXITY, id) {
206206
cx.sess().span_note_without_error(

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a> Iterator for Parser<'a> {
8686
/// `syntax::parse::lexer::comments::strip_doc_comment_decoration` because we
8787
/// need to keep track of
8888
/// the spans but this function is inspired from the later.
89-
#[allow(cast_possible_truncation)]
89+
#[allow(clippy::cast_possible_truncation)]
9090
pub fn strip_doc_comment_decoration(comment: &str, span: Span) -> (String, Vec<(usize, Span)>) {
9191
// one-line comments lose their prefix
9292
const ONELINERS: &[&str] = &["///!", "///", "//!", "//"];

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl LintPass for UnportableVariant {
4343
}
4444

4545
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
46-
#[allow(cast_possible_truncation, cast_sign_loss)]
46+
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
4747
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
4848
if cx.tcx.data_layout.pointer_size.bits() != 64 {
4949
return;

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn partial_rmatch(post: &str, name: &str) -> usize {
147147
}
148148

149149
// FIXME: #600
150-
#[allow(while_let_on_iterator)]
150+
#[allow(clippy::while_let_on_iterator)]
151151
fn check_variant(
152152
cx: &EarlyContext<'_>,
153153
threshold: u64,

clippy_lints/src/eq_op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
8383
BinOpKind::Lt | BinOpKind::Le | BinOpKind::Ge | BinOpKind::Gt => (cx.tcx.lang_items().ord_trait(), true),
8484
};
8585
if let Some(trait_id) = trait_id {
86-
#[allow(match_same_arms)]
86+
#[allow(clippy::match_same_arms)]
8787
match (&left.node, &right.node) {
8888
// do not suggest to dereference literals
8989
(&ExprKind::Lit(..), _) | (_, &ExprKind::Lit(..)) => {},

clippy_lints/src/identity_op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp {
5959
}
6060
}
6161

62-
#[allow(cast_possible_wrap)]
62+
#[allow(clippy::cast_possible_wrap)]
6363
fn check(cx: &LateContext<'_, '_>, e: &Expr, m: i8, span: Span, arg: Span) {
6464
if let Some(Constant::Int(v)) = constant_simple(cx, cx.tables, e) {
6565
let check = match cx.tables.expr_ty(e).sty {

clippy_lints/src/int_plus_one.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ enum Side {
5353
}
5454

5555
impl IntPlusOne {
56-
#[allow(cast_sign_loss)]
56+
#[allow(clippy::cast_sign_loss)]
5757
fn check_lit(&self, lit: &Lit, target_value: i128) -> bool {
5858
if let LitKind::Int(value, ..) = lit.node {
5959
return value == (target_value as u128);

clippy_lints/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
#![feature(slice_patterns)]
66
#![feature(stmt_expr_attributes)]
77
#![feature(range_contains)]
8-
#![allow(unknown_lints, shadow_reuse, missing_docs_in_private_items)]
8+
#![allow(unknown_lints, clippy::shadow_reuse, clippy::missing_docs_in_private_items)]
99
#![recursion_limit = "256"]
1010
#![feature(macro_at_most_once_rep)]
11+
#![feature(tool_lints)]
1112
#![warn(rust_2018_idioms)]
1213

1314
use toml;
@@ -933,7 +934,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
933934

934935
// only exists to let the dogfood integration test works.
935936
// Don't run clippy as an executable directly
936-
#[allow(dead_code, print_stdout)]
937+
#[allow(dead_code, clippy::print_stdout)]
937938
fn main() {
938939
panic!("Please use the cargo-clippy executable");
939940
}

clippy_lints/src/methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ impl LintPass for Pass {
714714
}
715715

716716
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
717-
#[allow(cyclomatic_complexity)]
717+
#[allow(clippy::cyclomatic_complexity)]
718718
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
719719
if in_macro(expr.span) {
720720
return;
@@ -922,7 +922,7 @@ fn lint_or_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span: Spa
922922
}
923923

924924
/// Check for `*or(foo())`.
925-
#[allow(too_many_arguments)]
925+
#[allow(clippy::too_many_arguments)]
926926
fn check_general_case(
927927
cx: &LateContext<'_, '_>,
928928
name: &str,

clippy_lints/src/neg_multiply.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl LintPass for NegMultiply {
3232
}
3333
}
3434

35-
#[allow(match_same_arms)]
35+
#[allow(clippy::match_same_arms)]
3636
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NegMultiply {
3737
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
3838
if let ExprKind::Binary(Spanned { node: BinOpKind::Mul, .. }, ref l, ref r) = e.node {

clippy_lints/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ enum FullInt {
15251525
}
15261526

15271527
impl FullInt {
1528-
#[allow(cast_sign_loss)]
1528+
#[allow(clippy::cast_sign_loss)]
15291529
fn cmp_s_u(s: i128, u: u128) -> Ordering {
15301530
if s < 0 {
15311531
Ordering::Less
@@ -1744,7 +1744,7 @@ impl LintPass for ImplicitHasher {
17441744
}
17451745

17461746
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
1747-
#[allow(cast_possible_truncation)]
1747+
#[allow(clippy::cast_possible_truncation)]
17481748
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
17491749
use syntax_pos::BytePos;
17501750

clippy_lints/src/utils/author.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! A group of attributes that can be attached to Rust code in order
22
//! to generate a clippy lint detecting said code automatically.
33
4-
#![allow(print_stdout, use_debug)]
4+
#![allow(clippy::print_stdout, clippy::use_debug)]
55

66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_tool_lint, lint_array};

clippy_lints/src/utils/comparisons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Utility functions about comparison operators.
22
3-
#![deny(missing_docs_in_private_items)]
3+
#![deny(clippy::missing_docs_in_private_items)]
44

55
use rustc::hir::{BinOpKind, Expr};
66

clippy_lints/src/utils/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Read configurations files.
22
3-
#![deny(missing_docs_in_private_items)]
3+
#![deny(clippy::missing_docs_in_private_items)]
44

55
use lazy_static::lazy_static;
66
use std::{env, fmt, fs, io, path};

clippy_lints/src/utils/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This module contains some useful constants.
22
3-
#![deny(missing_docs_in_private_items)]
3+
#![deny(clippy::missing_docs_in_private_items)]
44

55
/// List of the built-in types names.
66
///

clippy_lints/src/utils/higher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This module contains functions for retrieve the original AST from lowered
22
//! `hir`.
33
4-
#![deny(missing_docs_in_private_items)]
4+
#![deny(clippy::missing_docs_in_private_items)]
55

66
use if_chain::if_chain;
77
use rustc::{hir, ty};

clippy_lints/src/utils/hir_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
364364
}.hash(&mut self.s);
365365
}
366366

367-
#[allow(many_single_char_names)]
367+
#[allow(clippy::many_single_char_names)]
368368
pub fn hash_expr(&mut self, e: &Expr) {
369369
if let Some(e) = constant_simple(self.cx, self.tables, e) {
370370
return e.hash(&mut self.s);

clippy_lints/src/utils/inspector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(print_stdout, use_debug)]
1+
#![allow(clippy::print_stdout, clippy::use_debug)]
22

33
//! checks for attributes
44

clippy_lints/src/utils/sugg.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Contains utility functions to generate suggestions.
2-
#![deny(missing_docs_in_private_items)]
3-
// currently ignores lifetimes and generics
4-
#![allow(use_self)]
2+
#![deny(clippy::missing_docs_in_private_items)]
53

64
use matches::matches;
75
use rustc::hir;
@@ -40,7 +38,7 @@ impl Display for Sugg<'_> {
4038
}
4139
}
4240

43-
#[allow(wrong_self_convention)] // ok, because of the function `as_ty` method
41+
#[allow(clippy::wrong_self_convention)] // ok, because of the function `as_ty` method
4442
impl<'a> Sugg<'a> {
4543
/// Prepare a suggestion from an expression.
4644
pub fn hir_opt(cx: &LateContext<'_, '_>, expr: &hir::Expr) -> Option<Self> {

src/driver.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// error-pattern:yummy
22
#![feature(box_syntax)]
33
#![feature(rustc_private)]
4-
#![allow(unknown_lints, missing_docs_in_private_items)]
4+
#![feature(tool_lints)]
5+
#![allow(unknown_lints, clippy::missing_docs_in_private_items)]
56

67
use rustc_driver::{self, driver::CompileController, Compilation};
78
use rustc_plugin;
89
use std::process::{exit, Command};
910

10-
#[allow(print_stdout)]
11+
#[allow(clippy::print_stdout)]
1112
fn show_version() {
1213
println!(env!("CARGO_PKG_VERSION"));
1314
}

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// error-pattern:cargo-clippy
22
#![feature(plugin_registrar)]
33
#![feature(rustc_private)]
4+
#![feature(tool_lints)]
45
#![allow(unknown_lints)]
5-
#![allow(missing_docs_in_private_items)]
6+
#![allow(clippy::missing_docs_in_private_items)]
67
#![warn(rust_2018_idioms)]
78

89
use rustc_plugin::Registry;

src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// error-pattern:yummy
22
#![feature(box_syntax)]
33
#![feature(rustc_private)]
4-
#![allow(unknown_lints, missing_docs_in_private_items)]
4+
#![feature(tool_lints)]
5+
#![allow(unknown_lints, clippy::missing_docs_in_private_items)]
56

67
const CARGO_CLIPPY_HELP: &str = r#"Checks a package to catch common mistakes and improve your Rust code.
78
@@ -28,12 +29,12 @@ it to allow or deny lints from the code, eg.:
2829
#[cfg_attr(feature = "cargo-clippy", allow(needless_lifetimes))]
2930
"#;
3031

31-
#[allow(print_stdout)]
32+
#[allow(clippy::print_stdout)]
3233
fn show_help() {
3334
println!("{}", CARGO_CLIPPY_HELP);
3435
}
3536

36-
#[allow(print_stdout)]
37+
#[allow(clippy::print_stdout)]
3738
fn show_version() {
3839
println!(env!("CARGO_PKG_VERSION"));
3940
}

0 commit comments

Comments
 (0)