Use expect for lint warnings (#15625)

changelog:none
This commit is contained in:
Samuel Tardieu 2025-10-07 06:40:53 +00:00 committed by GitHub
commit f3c020cd55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 57 additions and 83 deletions

View file

@ -248,7 +248,7 @@ macro_rules! define_Conf {
#[derive(Deserialize)]
#[serde(field_identifier, rename_all = "kebab-case")]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
enum Field { $($name,)* third_party, }
struct ConfVisitor<'a>(&'a SourceFile);
@ -1213,7 +1213,7 @@ mod tests {
for entry in toml_files {
let file = fs::read_to_string(entry.path()).unwrap();
#[allow(clippy::zero_sized_map_values)]
#[expect(clippy::zero_sized_map_values)]
if let Ok(map) = toml::from_str::<HashMap<String, IgnoredAny>>(&file) {
for name in map.keys() {
names.remove(name.as_str());

View file

@ -131,7 +131,7 @@ impl DisallowedPathEnum {
}
/// Creates a map of disallowed items to the reason they were disallowed.
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
pub fn create_disallowed_map<const REPLACEMENT_ALLOWED: bool>(
tcx: TyCtxt<'_>,
disallowed_paths: &'static [DisallowedPath<REPLACEMENT_ALLOWED>],

View file

@ -4,7 +4,7 @@ use itertools::Itertools;
/// # Panics
///
/// Panics if unable to run the dogfood test
#[allow(clippy::fn_params_excessive_bools)]
#[expect(clippy::fn_params_excessive_bools)]
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool, allow_no_vcs: bool) {
run_exit_on_err(
"cargo test",

View file

@ -192,7 +192,7 @@ enum DevCommand {
/// Which lint's page to load initially (optional)
lint: Option<String>,
},
#[allow(clippy::doc_markdown)]
#[expect(clippy::doc_markdown)]
/// Manually run clippy on a file or package
///
/// ## Examples

View file

@ -443,7 +443,6 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
Ok(())
}
#[allow(clippy::too_many_lines)]
fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str> {
let lint_name_upper = lint.name.to_uppercase();

View file

@ -167,7 +167,7 @@ declare_clippy_lint! {
impl_lint_pass!(ArbitrarySourceItemOrdering => [ARBITRARY_SOURCE_ITEM_ORDERING]);
#[derive(Debug)]
#[allow(clippy::struct_excessive_bools)] // Bools are cached feature flags.
#[expect(clippy::struct_excessive_bools, reason = "Bools are cached feature flags")]
pub struct ArbitrarySourceItemOrdering {
assoc_types_order: SourceItemOrderingTraitAssocItemKinds,
enable_ordering_for_enum: bool,

View file

@ -7,7 +7,6 @@ macro_rules! declare_with_version {
$e:expr,
)*]) => {
pub static $name: &[(&str, &str)] = &[$($e),*];
#[allow(unused)]
pub static $name_version: &[&str] = &[$($version),*];
};
}

View file

@ -968,7 +968,7 @@ fn check_for_code_clusters<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a
/// This walks the "events" (think sections of markdown) produced by `pulldown_cmark`,
/// so lints here will generally access that information.
/// Returns documentation headers -- whether a "Safety", "Errors", "Panic" section was found
#[allow(clippy::too_many_lines)] // Only a big match statement
#[expect(clippy::too_many_lines, reason = "big match statement")]
fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize>)>>(
cx: &LateContext<'_>,
valid_idents: &FxHashSet<String>,

View file

@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
}
}
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx>>, expr: &Expr<'tcx>) {
let body = if let ExprKind::Closure(c) = expr.kind
&& c.fn_decl.inputs.iter().all(|ty| matches!(ty.kind, TyKind::Infer(())))

View file

@ -39,7 +39,6 @@ declare_clippy_lint! {
"useless use of `format!`"
}
#[allow(clippy::module_name_repetitions)]
pub struct UselessFormat {
format_args: FormatArgsStorage,
}

View file

@ -237,7 +237,7 @@ impl_lint_pass!(FormatArgs<'_> => [
POINTER_FORMAT,
]);
#[allow(clippy::struct_field_names)]
#[expect(clippy::struct_field_names)]
pub struct FormatArgs<'tcx> {
format_args: FormatArgsStorage,
msrv: Msrv,

View file

@ -132,7 +132,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
}
// FIXME: needs to be an EARLY LINT. all attribute lints should be
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_needless_must_use(
cx: &LateContext<'_>,
decl: &hir::FnDecl<'_>,

View file

@ -62,7 +62,7 @@ fn check_fn_sig<'a>(cx: &LateContext<'a>, decl: &FnDecl<'a>, span: Span, sig: ty
}
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(crate) fn check_fn<'a>(
cx: &LateContext<'a>,
kind: FnKind<'a>,

View file

@ -112,7 +112,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitSaturatingSub {
}
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_manual_check<'tcx>(
cx: &LateContext<'tcx>,
expr: &Expr<'tcx>,
@ -165,7 +165,7 @@ fn check_manual_check<'tcx>(
}
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_gt(
cx: &LateContext<'_>,
condition_span: Span,
@ -196,7 +196,7 @@ fn is_side_effect_free(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
eq_expr_value(cx, expr, expr)
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_subtraction(
cx: &LateContext<'_>,
condition_span: Span,

View file

@ -184,7 +184,7 @@ impl<'tcx> LateLintPass<'tcx> for Lifetimes {
}
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_fn_inner<'tcx>(
cx: &LateContext<'tcx>,
sig: &'tcx FnSig<'_>,
@ -540,7 +540,7 @@ fn has_where_lifetimes<'tcx>(cx: &LateContext<'tcx>, generics: &'tcx Generics<'_
false
}
#[allow(clippy::struct_excessive_bools)]
#[expect(clippy::struct_excessive_bools)]
struct Usage {
lifetime: Lifetime,
in_where_predicate: bool,

View file

@ -881,7 +881,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
}
impl Loops {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_for_loop<'tcx>(
&self,
cx: &LateContext<'tcx>,

View file

@ -240,7 +240,7 @@ fn is_label_for_block(cx: &LateContext<'_>, dest: &Destination) -> bool {
.is_ok_and(|hir_id| matches!(cx.tcx.hir_node(hir_id), Node::Block(_)))
}
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn never_loop_expr<'tcx>(
cx: &LateContext<'tcx>,
expr: &Expr<'tcx>,

View file

@ -35,7 +35,7 @@ pub(super) fn check_if_let<'tcx>(
check_arm(cx, false, pat, let_expr, body, None, else_expr, msrv);
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn check_arm<'tcx>(
cx: &LateContext<'tcx>,
outer_is_match: bool,

View file

@ -12,7 +12,6 @@ use rustc_span::symbol::{Symbol, sym};
use super::CLONE_ON_COPY;
/// Checks for the `CLONE_ON_COPY` lint.
#[allow(clippy::too_many_lines)]
pub(super) fn check(
cx: &LateContext<'_>,
expr: &Expr<'_>,

View file

@ -280,7 +280,7 @@ fn is_filter_ok_map_unwrap(cx: &LateContext<'_>, expr: &Expr<'_>, filter_arg: &E
}
/// lint use of `filter().map()` or `find().map()` for `Iterators`
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(super) fn check(
cx: &LateContext<'_>,
expr: &Expr<'_>,

View file

@ -8,7 +8,7 @@ use rustc_span::{Span, sym};
use super::MAP_ALL_ANY_IDENTITY;
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(super) fn check(
cx: &LateContext<'_>,
expr: &Expr<'_>,

View file

@ -4886,7 +4886,6 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
}
}
#[allow(clippy::too_many_lines)]
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
if impl_item.span.in_external_macro(cx.sess().source_map()) {
return;
@ -4958,7 +4957,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
}
impl Methods {
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn check_methods<'tcx>(&self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
// Handle method calls whose receiver and arguments may not come from expansion
if let Some((name, recv, args, span, call_span)) = method_call(expr) {

View file

@ -14,7 +14,7 @@ use super::SEARCH_IS_SOME;
/// lint searching an Iterator followed by `is_some()`
/// or calling `find()` on a string followed by `is_some()` or `is_none()`
#[allow(clippy::too_many_arguments, clippy::too_many_lines)]
#[expect(clippy::too_many_arguments, clippy::too_many_lines)]
pub(super) fn check<'tcx>(
cx: &LateContext<'_>,
expr: &'tcx hir::Expr<'_>,

View file

@ -271,7 +271,6 @@ struct IterUsage {
span: Span,
}
#[allow(clippy::too_many_lines)]
fn parse_iter_usage<'tcx>(
cx: &LateContext<'tcx>,
ctxt: SyntaxContext,

View file

@ -66,7 +66,7 @@ pub fn check<'tcx>(
/// Checks whether `expr` is a referent in an `AddrOf` expression and, if so, determines whether its
/// call of a `to_owned`-like function is unnecessary.
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn check_addr_of_expr(
cx: &LateContext<'_>,
expr: &Expr<'_>,

View file

@ -81,7 +81,6 @@ impl fmt::Display for Convention {
}
}
#[allow(clippy::too_many_arguments)]
pub(super) fn check<'tcx>(
cx: &LateContext<'tcx>,
item_name: Symbol,

View file

@ -33,7 +33,7 @@ declare_clippy_lint! {
}
declare_lint_pass!(NeedlessMaybeSized => [NEEDLESS_MAYBE_SIZED]);
#[allow(clippy::struct_field_names)]
#[expect(clippy::struct_field_names)]
struct Bound<'tcx> {
/// The [`DefId`] of the type parameter the bound refers to
param: DefId,

View file

@ -364,7 +364,6 @@ impl MutablyUsedVariablesCtxt<'_> {
}
impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
#[allow(clippy::if_same_then_else)]
fn consume(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, id: HirId) {
if let euv::Place {
base:
@ -398,7 +397,6 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
fn use_cloned(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId) {}
#[allow(clippy::if_same_then_else)]
fn borrow(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, id: HirId, borrow: ty::BorrowKind) {
self.prev_bind = None;
if let euv::Place {

View file

@ -212,7 +212,7 @@ impl Usage {
/// The parameters being checked by the lint, indexed by both the parameter's `HirId` and the
/// `DefId` of the function paired with the parameter's index.
#[derive(Default)]
#[allow(clippy::struct_field_names)]
#[expect(clippy::struct_field_names)]
struct Params {
params: Vec<Param>,
by_id: HirIdMap<usize>,

View file

@ -47,7 +47,6 @@ fn check_compare<'a>(cx: &LateContext<'a>, bit_op: &Expr<'a>, cmp_op: BinOpKind,
}
}
#[allow(clippy::too_many_lines)]
fn check_bit_mask(
cx: &LateContext<'_>,
bit_op: BinOpKind,

View file

@ -85,7 +85,7 @@ impl<'tcx> LateLintPass<'tcx> for Swap {
}
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn generate_swap_warning<'tcx>(
block: &'tcx Block<'tcx>,
cx: &LateContext<'tcx>,

View file

@ -238,7 +238,7 @@ impl TraitBounds {
}
}
#[allow(clippy::mutable_key_type)]
#[expect(clippy::mutable_key_type)]
fn check_type_repetition<'tcx>(&self, cx: &LateContext<'tcx>, generics: &'tcx Generics<'_>) {
struct SpanlessTy<'cx, 'tcx> {
ty: &'tcx Ty<'tcx>,

View file

@ -693,7 +693,7 @@ impl Types {
}
}
#[allow(clippy::struct_excessive_bools, clippy::struct_field_names)]
#[expect(clippy::struct_excessive_bools)]
#[derive(Clone, Copy, Default)]
struct CheckTyContext {
is_in_trait_impl: bool,

View file

@ -489,7 +489,6 @@ enum HasSafetyComment {
}
/// Checks if the lines immediately preceding the item contain a safety comment.
#[allow(clippy::collapsible_match)]
fn item_has_safety_comment(cx: &LateContext<'_>, item: &hir::Item<'_>) -> HasSafetyComment {
match span_from_macro_expansion_has_safety_comment(cx, item.span) {
HasSafetyComment::Maybe => (),
@ -551,7 +550,6 @@ fn item_has_safety_comment(cx: &LateContext<'_>, item: &hir::Item<'_>) -> HasSaf
}
/// Checks if the lines immediately preceding the item contain a safety comment.
#[allow(clippy::collapsible_match)]
fn stmt_has_safety_comment(
cx: &LateContext<'_>,
span: Span,

View file

@ -205,7 +205,6 @@ struct PrintVisitor<'a, 'tcx> {
first: Cell<bool>,
}
#[allow(clippy::unused_self)]
impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
fn new(cx: &'a LateContext<'tcx>) -> Self {
Self {
@ -410,7 +409,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
self.expr(field!(arm.body));
}
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn expr(&self, expr: &Binding<&hir::Expr<'_>>) {
if let Some(higher::While { condition, body, .. }) = higher::While::hir(expr.value) {
bind!(self, condition, body);

View file

@ -143,7 +143,7 @@ pub fn eq_struct_rest(l: &StructRest, r: &StructRest) -> bool {
}
}
#[allow(clippy::too_many_lines)] // Just a big match statement
#[expect(clippy::too_many_lines, reason = "big match statement")]
pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
use ExprKind::*;
if !over(&l.attrs, &r.attrs, eq_attr) {
@ -328,7 +328,7 @@ pub fn eq_item<K>(l: &Item<K>, r: &Item<K>, mut eq_kind: impl FnMut(&K, &K) -> b
over(&l.attrs, &r.attrs, eq_attr) && eq_vis(&l.vis, &r.vis) && eq_kind(&l.kind, &r.kind)
}
#[expect(clippy::too_many_lines)] // Just a big match statement
#[expect(clippy::too_many_lines, reason = "big match statement")]
pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
use ItemKind::*;
match (l, r) {

View file

@ -490,17 +490,14 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
None => ident_search_pat(last.ident).1,
}
} else {
// this shouldn't be possible, but sure
#[allow(
clippy::collapsible_else_if,
reason = "we want to keep these cases together, since they are both impossible"
)]
if qself_path.is_some() {
// last `>` in `<Vec as IntoIterator>`
Pat::Str(">")
} else {
Pat::Str("")
}
// this shouldn't be possible
Pat::Str(
if qself_path.is_some() {
">" // last `>` in `<Vec as IntoIterator>`
} else {
""
}
)
};
(start, end)
},

View file

@ -2,7 +2,7 @@
//!
//! This cannot use rustc's const eval, aka miri, as arbitrary HIR expressions cannot be lowered to
//! executable MIR bodies, so we have to do this instead.
#![allow(clippy::float_cmp)]
#![expect(clippy::float_cmp)]
use crate::source::{SpanRangeExt, walk_span_to_context};
use crate::{clip, is_direct_expn_of, paths, sext, sym, unsext};

View file

@ -212,7 +212,7 @@ pub struct Range<'a> {
impl<'a> Range<'a> {
/// Higher a `hir` range to something similar to `ast::ExprKind::Range`.
#[allow(clippy::similar_names)]
#[expect(clippy::similar_names)]
pub fn hir(expr: &'a Expr<'_>) -> Option<Range<'a>> {
match expr.kind {
ExprKind::Call(path, [arg1, arg2])

View file

@ -31,8 +31,10 @@ extern crate rustc_ast;
extern crate rustc_attr_parsing;
extern crate rustc_const_eval;
extern crate rustc_data_structures;
// The `rustc_driver` crate seems to be required in order to use the `rust_ast` crate.
#[allow(unused_extern_crates)]
#[expect(
unused_extern_crates,
reason = "The `rustc_driver` crate seems to be required in order to use the `rust_ast` crate."
)]
extern crate rustc_driver;
extern crate rustc_errors;
extern crate rustc_hir;
@ -2813,7 +2815,6 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &Expr<'tcx>) -> ExprUseCtx
moved_before_use,
same_ctxt,
},
#[allow(unreachable_patterns)]
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
None => ExprUseCtxt {
node: Node::Crate(cx.tcx.hir_root_module()),

View file

@ -134,7 +134,7 @@ pub fn used_exactly_once(mir: &Body<'_>, local: Local) -> Option<bool> {
}
/// Returns the `mir::Body` containing the node associated with `hir_id`.
#[allow(clippy::module_name_repetitions)]
#[expect(clippy::module_name_repetitions)]
pub fn enclosing_mir(tcx: TyCtxt<'_>, hir_id: HirId) -> Option<&Body<'_>> {
let body_owner_local_def_id = tcx.hir_enclosing_body_owner(hir_id);
if tcx.hir_body_owner_kind(body_owner_local_def_id).is_fn_or_closure() {

View file

@ -15,7 +15,6 @@ use std::ops::ControlFlow;
/// Collects the possible borrowers of each local.
/// For example, `b = &a; c = &a;` will make `b` and (transitively) `c`
/// possible borrowers of `a`.
#[allow(clippy::module_name_repetitions)]
struct PossibleBorrowerVisitor<'a, 'b, 'tcx> {
possible_borrower: TransitiveRelation,
body: &'b mir::Body<'tcx>,
@ -167,7 +166,6 @@ fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
}
/// Result of `PossibleBorrowerVisitor`.
#[allow(clippy::module_name_repetitions)]
pub struct PossibleBorrowerMap<'b, 'tcx> {
/// Mapping `Local -> its possible borrowers`
pub map: FxHashMap<mir::Local, DenseBitSet<mir::Local>>,

View file

@ -8,7 +8,6 @@ use rustc_middle::mir;
/// Collect possible borrowed for every `&mut` local.
/// For example, `_1 = &mut _2` generate _1: {_2,...}
/// Known Problems: not sure all borrowed are tracked
#[allow(clippy::module_name_repetitions)]
pub(super) struct PossibleOriginVisitor<'a, 'tcx> {
possible_origin: TransitiveRelation,
body: &'a mir::Body<'tcx>,

View file

@ -143,7 +143,7 @@ pub trait SpanRangeExt: SpanRange {
map_range(cx.sess().source_map(), self.into_range(), f)
}
#[allow(rustdoc::invalid_rust_codeblocks, reason = "The codeblock is intentionally broken")]
#[expect(rustdoc::invalid_rust_codeblocks, reason = "The codeblock is intentionally broken")]
/// Extends the range to include all preceding whitespace characters.
///
/// The range will not be expanded if it would cross a line boundary, the line the range would

View file

@ -954,7 +954,6 @@ pub fn approx_ty_size<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> u64 {
}
/// Asserts that the given arguments match the generic parameters of the given item.
#[allow(dead_code)]
fn assert_generic_args_match<'tcx>(tcx: TyCtxt<'tcx>, did: DefId, args: &[GenericArg<'tcx>]) {
let g = tcx.generics_of(did);
let parent = g.parent.map(|did| tcx.generics_of(did));

View file

@ -329,7 +329,7 @@ fn update_res(
None
}
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation)]
fn type_is_inferable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
let Some(callee_def_id) = (match expr.kind {
ExprKind::Call(callee, _) => {

View file

@ -591,7 +591,7 @@ pub fn for_each_local_use_after_expr<'tcx, B>(
// Calls the given function for every unconsumed temporary created by the expression. Note the
// function is only guaranteed to be called for types which need to be dropped, but it may be called
// for other types.
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
pub fn for_each_unconsumed_temporary<'tcx, B>(
cx: &LateContext<'tcx>,
e: &'tcx Expr<'tcx>,

View file

@ -2,7 +2,7 @@ use clap::{Parser, Subcommand, ValueEnum};
use std::num::NonZero;
use std::path::PathBuf;
#[allow(clippy::struct_excessive_bools)]
#[expect(clippy::struct_excessive_bools)]
#[derive(Parser, Clone, Debug)]
#[command(args_conflicts_with_subcommands = true)]
pub(crate) struct LintcheckConfig {

View file

@ -180,7 +180,7 @@ impl CrateWithSource {
/// copies a local folder
#[expect(clippy::too_many_lines)]
fn download_and_extract(&self) -> Crate {
#[allow(clippy::result_large_err)]
#[expect(clippy::result_large_err)]
fn get(path: &str) -> Result<ureq::Response, ureq::Error> {
const MAX_RETRIES: u8 = 4;
let mut retries = 0;

View file

@ -66,7 +66,7 @@ struct Crate {
impl Crate {
/// Run `cargo clippy` on the `Crate` and collect and return all the lint warnings that clippy
/// issued
#[allow(clippy::too_many_arguments, clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn run_clippy_lints(
&self,
clippy_driver_path: &Path,
@ -314,7 +314,7 @@ fn main() {
}
}
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
fn lintcheck(config: LintcheckConfig) {
let clippy_ver = build_clippy(config.perf);
let clippy_driver_path = fs::canonicalize(format!(

View file

@ -133,8 +133,7 @@ struct ClippyCallbacks {
}
impl rustc_driver::Callbacks for ClippyCallbacks {
// JUSTIFICATION: necessary in clippy driver to set `mir_opt_level`
#[allow(rustc::bad_opt_access)]
#[expect(rustc::bad_opt_access, reason = "necessary in clippy driver to set `mir_opt_level`")]
fn config(&mut self, config: &mut interface::Config) {
let conf_path = clippy_config::lookup_conf_file();
let previous = config.register_lints.take();
@ -182,15 +181,13 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
}
}
#[allow(clippy::ignored_unit_patterns)]
fn display_help() {
println!("{}", help_message());
}
const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml";
#[allow(clippy::too_many_lines)]
#[allow(clippy::ignored_unit_patterns)]
#[expect(clippy::too_many_lines)]
pub fn main() {
// See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
// about jemalloc.

View file

@ -10,12 +10,10 @@ use std::process::{self, Command};
use anstream::println;
#[allow(clippy::ignored_unit_patterns)]
fn show_help() {
println!("{}", help_message());
}
#[allow(clippy::ignored_unit_patterns)]
fn show_version() {
let version_info = rustc_tools_util::get_version_info!();
println!("{version_info}");

View file

@ -291,7 +291,6 @@ fn run_ui_toml(cx: &TestContext) {
}
// Allow `Default::default` as `OptWithSpan` is not nameable
#[allow(clippy::default_trait_access)]
fn run_ui_cargo(cx: &TestContext) {
if IS_RUSTC_TEST_SUITE {
return;
@ -473,7 +472,7 @@ struct DiagnosticCollector {
}
impl DiagnosticCollector {
#[allow(clippy::assertions_on_constants)]
#[expect(clippy::assertions_on_constants)]
fn spawn() -> (Self, thread::JoinHandle<()>) {
assert!(!IS_RUSTC_TEST_SUITE && !RUN_INTERNAL_TESTS);

View file

@ -18,7 +18,6 @@ type Result<T, E = AnyError> = std::result::Result<T, E>;
type AnyError = Box<dyn std::error::Error>;
#[test]
#[allow(clippy::case_sensitive_file_extension_comparisons)]
fn all_symbols_are_used() -> Result<()> {
if option_env!("RUSTC_TEST_SUITE").is_some() {
return Ok(());