Skip to content

Commit

Permalink
chore: add uninlined_format_args (MarcoIeni#1440)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
MarcoIeni and github-actions[bot] authored May 5, 2024
1 parent 1d4b061 commit facfe2e
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 27 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ if_then_some_else_none = "warn"
if_not_else = "warn"
semicolon_if_nothing_returned = "warn"
explicit_iter_loop = "warn"
uninlined_format_args = "warn"

# Allowing optional lints has no effect, but we list them to
# make clear that we reviewed them and we decided to allow them
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo_utils/src/local_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl LocalManifest {
anyhow::bail!("can only edit absolute paths, got {}", path);
}
let data = std::fs::read_to_string(path)
.with_context(|| format!("Failed to read manifest contents. Path: {:?}", path))?;
.with_context(|| format!("Failed to read manifest contents. Path: {path:?}"))?;
let manifest = data.parse().context("Unable to parse Cargo.toml")?;
Ok(LocalManifest {
manifest,
Expand Down
15 changes: 6 additions & 9 deletions crates/release_plz/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,8 @@ mod tests {
#[test]
fn config_is_deserialized() {
let config = &format!(
"{}\
changelog_update = true",
BASE_WORKSPACE_CONFIG
"{BASE_WORKSPACE_CONFIG}\
changelog_update = true"
);

let mut expected_config = create_base_workspace_config();
Expand All @@ -470,9 +469,8 @@ mod tests {

fn config_package_release_is_deserialized(config_flag: &str, expected_value: bool) {
let config = &format!(
"{}\n{}\
release = {}",
BASE_WORKSPACE_CONFIG, BASE_PACKAGE_CONFIG, config_flag
"{BASE_WORKSPACE_CONFIG}\n{BASE_PACKAGE_CONFIG}\
release = {config_flag}"
);

let mut expected_config = create_base_workspace_config();
Expand All @@ -496,9 +494,8 @@ mod tests {

fn config_workspace_release_is_deserialized(config_flag: &str, expected_value: bool) {
let config = &format!(
"{}\
release = {}",
BASE_WORKSPACE_CONFIG, config_flag
"{BASE_WORKSPACE_CONFIG}\
release = {config_flag}"
);

let mut expected_config = create_base_workspace_config();
Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz/src/generate_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn generate_schema_json() -> anyhow::Result<String> {
// See here for update on resolution: https://github.com/GREsau/schemars/issues/229
json = json.replace(
SCHEMA_TOKEN,
&format!("{}\n {}{}/{}\",", SCHEMA_TOKEN, ID, FOLDER, FILE),
&format!("{SCHEMA_TOKEN}\n {ID}{FOLDER}/{FILE}\","),
);

Ok(json)
Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn actions_secret_url(repo_url: &str) -> String {
}

fn repo_settings_url(repo_url: &str) -> String {
format!("{}/settings", repo_url)
format!("{repo_url}/settings")
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz/tests/all/helpers/gitea/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub const CARGO_INDEX_REPO: &str = "_cargo-index";

fn gitea_endpoint(endpoint: &str) -> String {
let api_url = format!("http://{}/api/v1", gitea_address());
format!("{}/{}", api_url, endpoint)
format!("{api_url}/{endpoint}")
}

pub fn gitea_address() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz/tests/all/helpers/reqwest_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ReqwestUtils for Response {
if self.status().is_success() {
Ok(self)
} else {
let response_dbg = format!("{:?}", self);
let response_dbg = format!("{:?}", &self);
let body = self.text().await.context("can't convert body to text")?;
anyhow::bail!(
"Unexpected response. \
Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz/tests/all/helpers/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ fn cargo_config(username: &str) -> String {
[net]
git-fetch-with-cli = true
"#;
format!("{}{}{}", cargo_registries, gitea_index, config_end)
format!("{cargo_registries}{gitea_index}{config_end}")
}

fn git_client(repo_url: &str, token: &str) -> GitClient {
Expand Down
6 changes: 3 additions & 3 deletions crates/release_plz/tests/all/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn release_plz_releases_a_new_project_with_custom_tag_name() {

let crate_name = &context.gitea.repo;

let expected_tag = format!("{}--0.1.0", crate_name);
let expected_tag = format!("{crate_name}--0.1.0");
let is_tag_created = || context.repo.tag_exists(&expected_tag).unwrap();

assert!(!is_tag_created());
Expand Down Expand Up @@ -85,7 +85,7 @@ async fn release_plz_releases_a_new_project_with_custom_release() {
let crate_name = &context.gitea.repo;

let expected_tag = "v0.1.0";
let expected_release = format!("{}--0.1.0", crate_name);
let expected_release = format!("{crate_name}--0.1.0");

context.run_release().success();

Expand Down Expand Up @@ -117,7 +117,7 @@ async fn release_plz_releases_after_release_pr_merged() {
let crate_name = &context.gitea.repo;

let expected_tag = "v0.1.0";
let expected_release = format!("{}--0.1.0", crate_name);
let expected_release = format!("{crate_name}--0.1.0");

context.run_release().success();

Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz_core/src/fs_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn strip_prefix(path: &Utf8Path, prefix: impl AsRef<Path>) -> anyhow::Result
}

pub fn to_utf8_path(path: &Path) -> anyhow::Result<&Utf8Path> {
Utf8Path::from_path(path).with_context(|| format!("cannot convert {:?} to Utf8Path", path))
Utf8Path::from_path(path).with_context(|| format!("cannot convert {path:?} to Utf8Path"))
}

pub fn current_directory() -> anyhow::Result<Utf8PathBuf> {
Expand Down
7 changes: 2 additions & 5 deletions crates/release_plz_core/src/lock_compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ fn are_dependencies_updated(
registry_lock: &Utf8Path,
) -> anyhow::Result<bool> {
let local_lock: Lockfile = read_lockfile(local_lock)
.with_context(|| format!("failed to load lockfile of local package {:?}", local_lock))?;
.with_context(|| format!("failed to load lockfile of local package {local_lock:?}"))?;
let registry_lock = read_lockfile(registry_lock).with_context(|| {
format!(
"failed to load lockfile of registry package {:?}",
registry_lock
)
format!("failed to load lockfile of registry package {registry_lock:?}")
})?;
let local_lock_packages = PackagesByName::new(&local_lock.packages);
Ok(are_dependencies_of_lockfiles_updated(
Expand Down
2 changes: 1 addition & 1 deletion crates/release_plz_core/src/next_ver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ fn check_for_typos(packages: &HashSet<String>, overrides: &HashSet<String>) -> a
missing.sort();
let missing = missing
.iter()
.map(|s| format!("`{}`", s))
.map(|s| format!("`{s}`"))
.collect::<Vec<_>>()
.join(", ");

Expand Down
3 changes: 1 addition & 2 deletions crates/release_plz_core/src/pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ fn pr_body(
let changes = {
let changes = packages_to_update.changes(project_contains_multiple_pub_packages);
format!(
"<details><summary><i><b>Changelog</b></i></summary><p>\n\n{}\n</p></details>\n",
changes
"<details><summary><i><b>Changelog</b></i></summary><p>\n\n{changes}\n</p></details>\n"
)
};

Expand Down

0 comments on commit facfe2e

Please sign in to comment.