Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use expect instead of allow #138389

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/src/core/build_steps/suggest.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
*/

Expand Down Expand Up @@ -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();
*/

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1025,7 +1025,7 @@ pub struct LibcxxVersionTool {
pub target: TargetSelection,
}

#[allow(dead_code)]
#[expect(dead_code)]
#[derive(Debug, Clone)]
pub enum LibcxxVersion {
Gnu(usize),
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[allow(clippy::module_inception)]
#[expect(clippy::module_inception)]
mod config;
pub mod flags;
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 2 additions & 3 deletions src/bootstrap/src/utils/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/src/utils/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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() {
Expand Down Expand Up @@ -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)));
Expand Down
Loading