Skip to content

Commit 2375b19

Browse files
committed
refactor(package): use format_arg! to avoid allocations
1 parent 4244b64 commit 2375b19

File tree

1 file changed

+6
-3
lines changed
  • src/cargo/ops/cargo_package

1 file changed

+6
-3
lines changed

src/cargo/ops/cargo_package/vcs.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ pub fn check_repo_state(
4949
) -> CargoResult<Option<VcsInfo>> {
5050
let Ok(repo) = git2::Repository::discover(p.root()) else {
5151
gctx.shell().verbose(|shell| {
52-
shell.warn(format!("no (git) VCS found for `{}`", p.root().display()))
52+
shell.warn(format_args!(
53+
"no (git) VCS found for `{}`",
54+
p.root().display()
55+
))
5356
})?;
5457
// No Git repo found. Have to assume it is clean.
5558
return Ok(None);
@@ -69,7 +72,7 @@ pub fn check_repo_state(
6972
let path = paths::strip_prefix_canonical(path, workdir).unwrap_or_else(|_| path.to_path_buf());
7073
let Ok(status) = repo.status_file(&path) else {
7174
gctx.shell().verbose(|shell| {
72-
shell.warn(format!(
75+
shell.warn(format_args!(
7376
"no (git) Cargo.toml found at `{}` in workdir `{}`",
7477
path.display(),
7578
workdir.display()
@@ -82,7 +85,7 @@ pub fn check_repo_state(
8285

8386
if !(status & git2::Status::IGNORED).is_empty() {
8487
gctx.shell().verbose(|shell| {
85-
shell.warn(format!(
88+
shell.warn(format_args!(
8689
"found (git) Cargo.toml ignored at `{}` in workdir `{}`",
8790
path.display(),
8891
workdir.display()

0 commit comments

Comments
 (0)