Skip to content

Commit

Permalink
Adapt codebase to the tool_lints
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Aug 1, 2018
1 parent e277b8e commit 4b79a5e
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
},
hir::ExprKind::Assign(ref assignee, ref e) => {
if let hir::ExprKind::Binary(op, ref l, ref r) = e.node {
#[allow(cyclomatic_complexity)]
#[allow(clippy::cyclomatic_complexity)]
let lint = |assignee: &hir::Expr, rhs: &hir::Expr| {
let ty = cx.tables.expr_ty(assignee);
let rty = cx.tables.expr_ty(rhs);
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(cast_possible_truncation)]
#![allow(float_cmp)]
#![allow(clippy::float_cmp)]

use rustc::lint::LateContext;
use rustc::{span_bug, bug};
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/cyclomatic_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CCHelper<'a, 'tcx> {
}

#[cfg(feature = "debugging")]
#[allow(too_many_arguments)]
#[allow(clippy::too_many_arguments)]
fn report_cc_bug(_: &LateContext<'_, '_>, cc: u64, narms: u64, div: u64, shorts: u64, returns: u64, span: Span, _: NodeId) {
span_bug!(
span,
Expand All @@ -200,7 +200,7 @@ fn report_cc_bug(_: &LateContext<'_, '_>, cc: u64, narms: u64, div: u64, shorts:
);
}
#[cfg(not(feature = "debugging"))]
#[allow(too_many_arguments)]
#[allow(clippy::too_many_arguments)]
fn report_cc_bug(cx: &LateContext<'_, '_>, cc: u64, narms: u64, div: u64, shorts: u64, returns: u64, span: Span, id: NodeId) {
if !is_allowed(cx, CYCLOMATIC_COMPLEXITY, id) {
cx.sess().span_note_without_error(
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![feature(iterator_find_map)]
#![feature(macro_at_most_once_rep)]
#![feature(rust_2018_preview)]
#![feature(tool_lints)]
#![warn(rust_2018_idioms)]

use toml;
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ impl LintPass for Pass {
}

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

/// Check for `*or(foo())`.
#[allow(too_many_arguments)]
#[allow(clippy::too_many_arguments)]
fn check_general_case(
cx: &LateContext<'_, '_>,
name: &str,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/comparisons.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utility functions about comparison operators.

#![deny(missing_docs_in_private_items)]
#![deny(clippy::missing_docs_in_private_items)]

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

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/conf.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Read configurations files.

#![deny(missing_docs_in_private_items)]
#![deny(clippy::missing_docs_in_private_items)]

use lazy_static::lazy_static;
use std::{env, fmt, fs, io, path};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module contains some useful constants.

#![deny(missing_docs_in_private_items)]
#![deny(clippy::missing_docs_in_private_items)]

/// List of the built-in types names.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/higher.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This module contains functions for retrieve the original AST from lowered
//! `hir`.

#![deny(missing_docs_in_private_items)]
#![deny(clippy::missing_docs_in_private_items)]

use if_chain::if_chain;
use rustc::{hir, ty};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
}.hash(&mut self.s);
}

#[allow(many_single_char_names)]
#[allow(clippy::many_single_char_names)]
pub fn hash_expr(&mut self, e: &Expr) {
if let Some(e) = constant_simple(self.cx, self.tables, e) {
return e.hash(&mut self.s);
Expand Down
6 changes: 2 additions & 4 deletions clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Contains utility functions to generate suggestions.
#![deny(missing_docs_in_private_items)]
// currently ignores lifetimes and generics
#![allow(use_self)]
#![deny(clippy::missing_docs_in_private_items)]

use matches::matches;
use rustc::hir;
Expand Down Expand Up @@ -40,7 +38,7 @@ impl Display for Sugg<'_> {
}
}

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

0 comments on commit 4b79a5e

Please sign in to comment.