Rollup merge of #139867 - WaffleLapkin:tidypaper, r=jieyouxu

Fix some tidy paper cuts

The main thing this fixes is that currently, if you run `x t tidy` it will format ~6K files, even though it's supposed to format only modified files (whatever this is a useful optimization or not is besides the point). The problem is that `x t tidy` never writes the `rustfmt` stamp, so it always assumes `rustfmt` that was last used is outdated and we need to recheck everything. This PR fixes it by actually writing the stamp.

There are also some minor tweaks to comments/diagnostics. cc ```@Kobzol``` this probably conflicts with #138591. I didn't fix anything, just tried to document better the status quo.

r? ```@jieyouxu```
This commit is contained in:
Matthias Krüger 2025-04-16 13:45:29 +02:00 committed by GitHub
commit b65e6b7c40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 16 deletions

View file

@ -682,8 +682,10 @@ pub static CRATES: &[&str] = &[
pub fn has_missing_submodule(root: &Path, submodules: &[&str]) -> bool {
!CiEnv::is_ci()
&& submodules.iter().any(|submodule| {
let path = root.join(submodule);
!path.exists()
// If the directory is empty, we can consider it as an uninitialized submodule.
read_dir(root.join(submodule)).unwrap().next().is_none()
|| read_dir(path).unwrap().next().is_none()
})
}