Rollup merge of #5713 - flip1995:more_lints, r=Manishearth

Use lints in Clippy that are enabled in rustc bootstrap

cc https://github.com/rust-lang/rust/pull/73297#discussion_r439747061

changelog: none
This commit is contained in:
Philipp Krones 2020-06-23 14:39:47 +02:00 committed by GitHub
commit 598a79f309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 17 deletions

View File

@ -1,19 +1,22 @@
// error-pattern:cargo-clippy // error-pattern:cargo-clippy
#![feature(bindings_after_at)] #![feature(bindings_after_at)]
#![feature(box_syntax)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(concat_idents)]
#![feature(crate_visibility_modifier)]
#![feature(drain_filter)]
#![feature(or_patterns)] #![feature(or_patterns)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]
#![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
#![recursion_limit = "512"] #![recursion_limit = "512"]
#![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)]
#![deny(rustc::internal)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![feature(crate_visibility_modifier)] #![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
#![feature(concat_idents)] #![warn(trivial_casts, trivial_numeric_casts)]
#![feature(drain_filter)] // warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]
// warn on rustc internal lints
#![deny(rustc::internal)]
// FIXME: switch to something more ergonomic here, once available. // FIXME: switch to something more ergonomic here, once available.
// (Currently there is no way to opt into sysroot crates without `extern crate`.) // (Currently there is no way to opt into sysroot crates without `extern crate`.)

View File

@ -1497,7 +1497,7 @@ struct MutatePairDelegate<'a, 'tcx> {
span_high: Option<Span>, span_high: Option<Span>,
} }
impl<'a, 'tcx> Delegate<'tcx> for MutatePairDelegate<'a, 'tcx> { impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: ConsumeMode) {} fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: ConsumeMode) {}
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, bk: ty::BorrowKind) { fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, bk: ty::BorrowKind) {
@ -1525,7 +1525,7 @@ fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>) {
} }
} }
impl<'a, 'tcx> MutatePairDelegate<'a, 'tcx> { impl MutatePairDelegate<'_, '_> {
fn mutation_span(&self) -> (Option<Span>, Option<Span>) { fn mutation_span(&self) -> (Option<Span>, Option<Span>) {
(self.span_low, self.span_high) (self.span_low, self.span_high)
} }
@ -2292,7 +2292,7 @@ struct HasBreakOrReturnVisitor {
has_break_or_return: bool, has_break_or_return: bool,
} }
impl<'a, 'tcx> Visitor<'tcx> for HasBreakOrReturnVisitor { impl<'tcx> Visitor<'tcx> for HasBreakOrReturnVisitor {
type Map = Map<'tcx>; type Map = Map<'tcx>;
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) { fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {

View File

@ -184,7 +184,7 @@ struct BinaryExprVisitor {
in_binary_expr: bool, in_binary_expr: bool,
} }
impl<'a, 'tcx> Visitor<'tcx> for BinaryExprVisitor { impl<'tcx> Visitor<'tcx> for BinaryExprVisitor {
type Map = Map<'tcx>; type Map = Map<'tcx>;
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) { fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {

View File

@ -58,7 +58,7 @@ pub struct TriviallyCopyPassByRef {
limit: u64, limit: u64,
} }
impl<'a, 'tcx> TriviallyCopyPassByRef { impl<'tcx> TriviallyCopyPassByRef {
pub fn new(limit: Option<u64>, target: &SessionConfig) -> Self { pub fn new(limit: Option<u64>, target: &SessionConfig) -> Self {
let limit = limit.unwrap_or_else(|| { let limit = limit.unwrap_or_else(|| {
let bit_width = u64::from(target.ptr_width); let bit_width = u64::from(target.ptr_width);

View File

@ -509,7 +509,7 @@ fn indentation<T: LintContext>(cx: &T, span: Span) -> Option<String> {
} }
/// Convenience extension trait for `DiagnosticBuilder`. /// Convenience extension trait for `DiagnosticBuilder`.
pub trait DiagnosticBuilderExt<'a, T: LintContext> { pub trait DiagnosticBuilderExt<T: LintContext> {
/// Suggests to add an attribute to an item. /// Suggests to add an attribute to an item.
/// ///
/// Correctly handles indentation of the attribute and item. /// Correctly handles indentation of the attribute and item.
@ -556,7 +556,7 @@ fn suggest_item_with_attr<D: Display + ?Sized>(
fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability); fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability);
} }
impl<'a, 'b, 'c, T: LintContext> DiagnosticBuilderExt<'c, T> for rustc_errors::DiagnosticBuilder<'b> { impl<T: LintContext> DiagnosticBuilderExt<T> for rustc_errors::DiagnosticBuilder<'_> {
fn suggest_item_with_attr<D: Display + ?Sized>( fn suggest_item_with_attr<D: Display + ?Sized>(
&mut self, &mut self,
cx: &T, cx: &T,

View File

@ -1,9 +1,15 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![feature(rustc_private)] #![feature(rustc_private)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]
// warn on rustc internal lints
#![deny(rustc::internal)]
// FIXME: switch to something more ergonomic here, once available. // FIXME: switch to something more ergonomic here, once available.
// (Currently there is no way to opt into sysroot crates without `extern crate`.) // (Currently there is no way to opt into sysroot crates without `extern crate`.)
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]
extern crate rustc_data_structures;
#[allow(unused_extern_crates)]
extern crate rustc_driver; extern crate rustc_driver;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]
extern crate rustc_errors; extern crate rustc_errors;
@ -93,7 +99,7 @@ fn config(&mut self, config: &mut interface::Config) {
#[allow(clippy::find_map, clippy::filter_map)] #[allow(clippy::find_map, clippy::filter_map)]
fn describe_lints() { fn describe_lints() {
use lintlist::{Level, Lint, ALL_LINTS, LINT_LEVELS}; use lintlist::{Level, Lint, ALL_LINTS, LINT_LEVELS};
use std::collections::HashSet; use rustc_data_structures::fx::FxHashSet;
println!( println!(
" "
@ -137,7 +143,7 @@ fn describe_lints() {
let scoped = |x: &str| format!("clippy::{}", x); let scoped = |x: &str| format!("clippy::{}", x);
let lint_groups: HashSet<_> = lints.iter().map(|lint| lint.group).collect(); let lint_groups: FxHashSet<_> = lints.iter().map(|lint| lint.group).collect();
println!("Lint checks provided by clippy:\n"); println!("Lint checks provided by clippy:\n");
println!(" {} {:7.7} meaning", padded("name"), "default"); println!(" {} {:7.7} meaning", padded("name"), "default");

View File

@ -1,4 +1,6 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]
use rustc_tools_util::VersionInfo; use rustc_tools_util::VersionInfo;
use std::env; use std::env;