Skip to content

Introducing clap on tidy#151262

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Shunpoco:tidy-clap
Jan 31, 2026
Merged

Introducing clap on tidy#151262
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Shunpoco:tidy-clap

Conversation

@Shunpoco
Copy link
Contributor

@Shunpoco Shunpoco commented Jan 17, 2026

Context

Currently tidy parses paths/flags from args_os manually, and the extraction is spreading multiple files. It may be a breeding ground for bugs.

ref: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/How.20--ci.3Dtrue.20interact.20with.20CiEnv.3F/near/543171560
(N.B. We've talked about introducing a ci flag in tidy in that thread, but I don't do it in this PR as I don't want to put multiple changes into a PR. I will introduce the flag in a coming PR.)

Changes

This PR replaces current parsing logic with clap. To confirm the new parser works fine, I introduce an unit test for it.

Build time

We've concerned about how clap increases the build time. In order to confirm the increment is acceptable, I did an experiment on CI:

  • Run cargo build without cache for tidy 50 times in each environment on CI
  • Calculate an average and a standard deviation from the result, and plot them

Here is the graph:
rust_tidy_build_time

  • Clap tends to increase build time ~2s. We think this is not a big problem
  • Build time differs in each environment
  • In some cases standard deviation are high, I suppose that busyness of CI instances affect build time

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants