Skip to content

Commit ab36eae

Browse files
committed
Auto merge of #5713 - flip1995:more_lints, r=Manishearth
Use lints in Clippy that are enabled in rustc bootstrap cc rust-lang/rust#73297 (comment) changelog: none
2 parents 7427065 + 40665ed commit ab36eae

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

clippy_lints/src/lib.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
// error-pattern:cargo-clippy
22

33
#![feature(bindings_after_at)]
4-
#![feature(box_syntax)]
54
#![feature(box_patterns)]
5+
#![feature(box_syntax)]
6+
#![feature(concat_idents)]
7+
#![feature(crate_visibility_modifier)]
8+
#![feature(drain_filter)]
69
#![feature(or_patterns)]
710
#![feature(rustc_private)]
811
#![feature(stmt_expr_attributes)]
9-
#![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
1012
#![recursion_limit = "512"]
11-
#![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)]
12-
#![deny(rustc::internal)]
1313
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
14-
#![feature(crate_visibility_modifier)]
15-
#![feature(concat_idents)]
16-
#![feature(drain_filter)]
14+
#![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
15+
#![warn(trivial_casts, trivial_numeric_casts)]
16+
// warn on lints, that are included in `rust-lang/rust`s bootstrap
17+
#![warn(rust_2018_idioms, unused_lifetimes)]
18+
// warn on rustc internal lints
19+
#![deny(rustc::internal)]
1720

1821
// FIXME: switch to something more ergonomic here, once available.
1922
// (Currently there is no way to opt into sysroot crates without `extern crate`.)

clippy_lints/src/loops.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
15241524
}
15251525
}
15261526

1527-
impl<'tcx> MutatePairDelegate {
1527+
impl MutatePairDelegate {
15281528
fn mutation_span(&self) -> (Option<Span>, Option<Span>) {
15291529
(self.span_low, self.span_high)
15301530
}
@@ -2290,7 +2290,7 @@ struct HasBreakOrReturnVisitor {
22902290
has_break_or_return: bool,
22912291
}
22922292

2293-
impl<'a, 'tcx> Visitor<'tcx> for HasBreakOrReturnVisitor {
2293+
impl<'tcx> Visitor<'tcx> for HasBreakOrReturnVisitor {
22942294
type Map = Map<'tcx>;
22952295

22962296
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {

clippy_lints/src/suspicious_trait_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ struct BinaryExprVisitor {
184184
in_binary_expr: bool,
185185
}
186186

187-
impl<'a, 'tcx> Visitor<'tcx> for BinaryExprVisitor {
187+
impl<'tcx> Visitor<'tcx> for BinaryExprVisitor {
188188
type Map = Map<'tcx>;
189189

190190
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {

clippy_lints/src/trivially_copy_pass_by_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub struct TriviallyCopyPassByRef {
5858
limit: u64,
5959
}
6060

61-
impl<'a, 'tcx> TriviallyCopyPassByRef {
61+
impl<'tcx> TriviallyCopyPassByRef {
6262
pub fn new(limit: Option<u64>, target: &SessionConfig) -> Self {
6363
let limit = limit.unwrap_or_else(|| {
6464
let bit_width = u64::from(target.ptr_width);

clippy_lints/src/utils/sugg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ fn indentation<T: LintContext>(cx: &T, span: Span) -> Option<String> {
509509
}
510510

511511
/// Convenience extension trait for `DiagnosticBuilder`.
512-
pub trait DiagnosticBuilderExt<'a, T: LintContext> {
512+
pub trait DiagnosticBuilderExt<T: LintContext> {
513513
/// Suggests to add an attribute to an item.
514514
///
515515
/// Correctly handles indentation of the attribute and item.
@@ -556,7 +556,7 @@ pub trait DiagnosticBuilderExt<'a, T: LintContext> {
556556
fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability);
557557
}
558558

559-
impl<'a, 'b, 'c, T: LintContext> DiagnosticBuilderExt<'c, T> for rustc_errors::DiagnosticBuilder<'b> {
559+
impl<T: LintContext> DiagnosticBuilderExt<T> for rustc_errors::DiagnosticBuilder<'_> {
560560
fn suggest_item_with_attr<D: Display + ?Sized>(
561561
&mut self,
562562
cx: &T,

src/driver.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
21
#![feature(rustc_private)]
2+
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
3+
// warn on lints, that are included in `rust-lang/rust`s bootstrap
4+
#![warn(rust_2018_idioms, unused_lifetimes)]
5+
// warn on rustc internal lints
6+
#![deny(rustc::internal)]
37

48
// FIXME: switch to something more ergonomic here, once available.
59
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
610
#[allow(unused_extern_crates)]
11+
extern crate rustc_data_structures;
12+
#[allow(unused_extern_crates)]
713
extern crate rustc_driver;
814
#[allow(unused_extern_crates)]
915
extern crate rustc_errors;
@@ -93,7 +99,7 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
9399
#[allow(clippy::find_map, clippy::filter_map)]
94100
fn describe_lints() {
95101
use lintlist::{Level, Lint, ALL_LINTS, LINT_LEVELS};
96-
use std::collections::HashSet;
102+
use rustc_data_structures::fx::FxHashSet;
97103

98104
println!(
99105
"
@@ -137,7 +143,7 @@ Available lint options:
137143

138144
let scoped = |x: &str| format!("clippy::{}", x);
139145

140-
let lint_groups: HashSet<_> = lints.iter().map(|lint| lint.group).collect();
146+
let lint_groups: FxHashSet<_> = lints.iter().map(|lint| lint.group).collect();
141147

142148
println!("Lint checks provided by clippy:\n");
143149
println!(" {} {:7.7} meaning", padded("name"), "default");

src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
2+
// warn on lints, that are included in `rust-lang/rust`s bootstrap
3+
#![warn(rust_2018_idioms, unused_lifetimes)]
24

35
use rustc_tools_util::VersionInfo;
46
use std::env;

0 commit comments

Comments
 (0)