use expect instead of allow

This is more useful than `allow` as compiler will force us to remove rules
that are no longer valid (we already got 2 of them in this change).

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2025-03-12 10:23:04 +03:00
parent d2b52c5c48
commit 675ae1afd0
10 changed files with 13 additions and 16 deletions

View file

@ -67,7 +67,7 @@ impl Std {
self
}
#[allow(clippy::wrong_self_convention)]
#[expect(clippy::wrong_self_convention)]
pub fn is_for_mir_opt_tests(mut self, is_for_mir_opt_tests: bool) -> Self {
self.is_for_mir_opt_tests = is_for_mir_opt_tests;
self

View file

@ -1,7 +1,5 @@
//! Attempt to magically identify good tests to run
#![cfg_attr(feature = "build-metrics", allow(unused))]
use std::path::PathBuf;
use std::str::FromStr;

View file

@ -3377,7 +3377,7 @@ impl Step for CodegenCranelift {
/*
let mut prepare_cargo = build_cargo();
prepare_cargo.arg("--").arg("prepare").arg("--download-dir").arg(&download_dir);
#[allow(deprecated)]
#[expect(deprecated)]
builder.config.try_run(&mut prepare_cargo.into()).unwrap();
*/
@ -3508,7 +3508,7 @@ impl Step for CodegenGCC {
/*
let mut prepare_cargo = build_cargo();
prepare_cargo.arg("--").arg("prepare");
#[allow(deprecated)]
#[expect(deprecated)]
builder.config.try_run(&mut prepare_cargo.into()).unwrap();
*/

View file

@ -209,7 +209,7 @@ impl Step for ToolBuild {
}
}
#[allow(clippy::too_many_arguments)] // FIXME: reduce the number of args and remove this.
#[expect(clippy::too_many_arguments)] // FIXME: reduce the number of args and remove this.
pub fn prepare_tool_cargo(
builder: &Builder<'_>,
compiler: Compiler,
@ -1025,7 +1025,7 @@ pub struct LibcxxVersionTool {
pub target: TargetSelection,
}
#[allow(dead_code)]
#[expect(dead_code)]
#[derive(Debug, Clone)]
pub enum LibcxxVersion {
Gnu(usize),

View file

@ -1289,7 +1289,6 @@ impl<'a> Builder<'a> {
host: TargetSelection,
target: TargetSelection,
) -> Compiler {
#![allow(clippy::let_and_return)]
let mut resolved_compiler = if self.build.force_use_stage2(stage) {
trace!(target: "COMPILER_FOR", ?stage, "force_use_stage2");
self.compiler(2, self.config.build)

View file

@ -1,4 +1,4 @@
#[allow(clippy::module_inception)]
#[expect(clippy::module_inception)]
mod config;
pub mod flags;
#[cfg(test)]

View file

@ -19,7 +19,7 @@ static SHOULD_FIX_BINS_AND_DYLIBS: OnceLock<bool> = OnceLock::new();
/// `Config::try_run` wrapper for this module to avoid warnings on `try_run`, since we don't have access to a `builder` yet.
fn try_run(config: &Config, cmd: &mut Command) -> Result<(), ()> {
#[allow(deprecated)]
#[expect(deprecated)]
config.try_run(cmd)
}

View file

@ -74,7 +74,7 @@ const LLD_FILE_NAMES: &[&str] = &["ld.lld", "ld64.lld", "lld-link", "wasm-ld"];
/// Extra `--check-cfg` to add when building the compiler or tools
/// (Mode restriction, config name, config values (if any))
#[allow(clippy::type_complexity)] // It's fine for hard-coded list and type is explained above.
#[expect(clippy::type_complexity)] // It's fine for hard-coded list and type is explained above.
const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
(None, "bootstrap", None),
(Some(Mode::Rustc), "llvm_enzyme", None),

View file

@ -125,7 +125,7 @@ impl BootstrapCommand {
Self { failure_behavior: BehaviorOnFailure::DelayFail, ..self }
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn fail_fast(self) -> Self {
Self { failure_behavior: BehaviorOnFailure::Exit, ..self }
}
@ -280,7 +280,7 @@ impl CommandOutput {
!self.is_success()
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn status(&self) -> Option<ExitStatus> {
match self.status {
CommandStatus::Finished(status) => Some(status),
@ -332,7 +332,6 @@ impl Default for CommandOutput {
/// Helper trait to format both Command and BootstrapCommand as a short execution line,
/// without all the other details (e.g. environment variables).
#[allow(unused)]
pub trait FormatShortCmd {
fn format_short_cmd(&self) -> String;
}

View file

@ -76,7 +76,7 @@ impl BuildMetrics {
// Consider all the stats gathered so far as the parent's.
if !state.running_steps.is_empty() {
self.collect_stats(&mut *state);
self.collect_stats(&mut state);
}
state.system_info.refresh_cpu_usage();
@ -102,7 +102,7 @@ impl BuildMetrics {
let mut state = self.state.borrow_mut();
self.collect_stats(&mut *state);
self.collect_stats(&mut state);
let step = state.running_steps.pop().unwrap();
if state.running_steps.is_empty() {
@ -224,6 +224,7 @@ impl BuildMetrics {
t!(serde_json::to_writer(&mut file, &json));
}
#[expect(clippy::only_used_in_recursion)]
fn prepare_json_step(&self, step: StepMetrics) -> JsonNode {
let mut children = Vec::new();
children.extend(step.children.into_iter().map(|child| self.prepare_json_step(child)));