Apply first set of Rustfmt edition 2024 changes (#13478)

Rustfmt introduces a lot of formatting changes in the 2024 edition. To
not break everything all at once, we split out the set of formatting
changes compatible with both the 2021 and 2024 edition by first
formatting with the 2024 style, and then again with the currently used
2021 style.

Notable changes are the formatting of derive macro attributes and lines
with overly long strings and adding trailing semicolons after statements
consistently.
This commit is contained in:
konsti 2025-05-17 02:19:02 +02:00 committed by GitHub
parent b31d08c683
commit 5d37c7ecc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
77 changed files with 660 additions and 313 deletions

View file

@ -245,7 +245,7 @@ fn find_module_root(
let dir = match fs_err::read_dir(src_root) {
Ok(dir_iterator) => dir_iterator.collect::<Result<Vec<_>, _>>()?,
Err(err) if err.kind() == io::ErrorKind::NotFound => {
return Err(Error::MissingSrc(src_root.to_path_buf()))
return Err(Error::MissingSrc(src_root.to_path_buf()));
}
Err(err) => return Err(Error::Io(err)),
};

View file

@ -30,9 +30,13 @@ pub(crate) const DEFAULT_EXCLUDES: &[&str] = &["__pycache__", "*.pyc", "*.pyo"];
pub enum ValidationError {
/// The spec isn't clear about what the values in that field would be, and we only support the
/// default value (UTF-8).
#[error("Charsets other than UTF-8 are not supported. Please convert your README to UTF-8 and remove `project.readme.charset`.")]
#[error(
"Charsets other than UTF-8 are not supported. Please convert your README to UTF-8 and remove `project.readme.charset`."
)]
ReadmeCharset,
#[error("Unknown Readme extension `{0}`, can't determine content type. Please use a support extension (`.md`, `.rst`, `.txt`) or set the content type manually.")]
#[error(
"Unknown Readme extension `{0}`, can't determine content type. Please use a support extension (`.md`, `.rst`, `.txt`) or set the content type manually."
)]
UnknownExtension(String),
#[error("Can't infer content type because `{}` does not have an extension. Please use a support extension (`.md`, `.rst`, `.txt`) or set the content type manually.", _0.user_display())]
MissingExtension(PathBuf),
@ -42,9 +46,13 @@ pub enum ValidationError {
DescriptionNewlines,
#[error("Dynamic metadata is not supported")]
Dynamic,
#[error("When `project.license-files` is defined, `project.license` must be an SPDX expression string")]
#[error(
"When `project.license-files` is defined, `project.license` must be an SPDX expression string"
)]
MixedLicenseGenerations,
#[error("Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`")]
#[error(
"Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`"
)]
InvalidGroup(String),
#[error(
"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `{0}`"
@ -260,7 +268,7 @@ impl PyProjectToml {
Some("rst") => "text/x-rst",
Some("md") => "text/markdown",
Some(unknown) => {
return Err(ValidationError::UnknownExtension(unknown.to_owned()).into())
return Err(ValidationError::UnknownExtension(unknown.to_owned()).into());
}
None => return Err(ValidationError::MissingExtension(path.clone()).into()),
}
@ -388,7 +396,7 @@ impl PyProjectToml {
None => None,
Some(License::Spdx(license_expression)) => Some(license_expression.clone()),
Some(License::Text { .. } | License::File { .. }) => {
return Err(ValidationError::MixedLicenseGenerations.into())
return Err(ValidationError::MixedLicenseGenerations.into());
}
};