Skip to content

Commit 7ed7612

Browse files
committed
refactor(toml): format arg captures
1 parent 4b0fac9 commit 7ed7612

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,20 +1901,17 @@ fn to_dependency_source_id<P: ResolveToPath + Clone>(
19011901
orig.registry_index.as_ref(),
19021902
) {
19031903
(Some(_git), _, Some(_registry), _) | (Some(_git), _, _, Some(_registry)) => bail!(
1904-
"dependency ({}) specification is ambiguous. \
1904+
"dependency ({name_in_toml}) specification is ambiguous. \
19051905
Only one of `git` or `registry` is allowed.",
1906-
name_in_toml
19071906
),
19081907
(_, _, Some(_registry), Some(_registry_index)) => bail!(
1909-
"dependency ({}) specification is ambiguous. \
1908+
"dependency ({name_in_toml}) specification is ambiguous. \
19101909
Only one of `registry` or `registry-index` is allowed.",
1911-
name_in_toml
19121910
),
19131911
(Some(_git), Some(_path), None, None) => {
19141912
bail!(
1915-
"dependency ({}) specification is ambiguous. \
1913+
"dependency ({name_in_toml}) specification is ambiguous. \
19161914
Only one of `git` or `path` is allowed.",
1917-
name_in_toml
19181915
);
19191916
}
19201917
(Some(git), None, None, None) => {
@@ -1925,9 +1922,8 @@ fn to_dependency_source_id<P: ResolveToPath + Clone>(
19251922

19261923
if n_details > 1 {
19271924
bail!(
1928-
"dependency ({}) specification is ambiguous. \
1925+
"dependency ({name_in_toml}) specification is ambiguous. \
19291926
Only one of `branch`, `tag` or `rev` is allowed.",
1930-
name_in_toml
19311927
);
19321928
}
19331929

@@ -1942,12 +1938,11 @@ fn to_dependency_source_id<P: ResolveToPath + Clone>(
19421938

19431939
if let Some(fragment) = loc.fragment() {
19441940
let msg = format!(
1945-
"URL fragment `#{}` in git URL is ignored for dependency ({}). \
1941+
"URL fragment `#{fragment}` in git URL is ignored for dependency ({name_in_toml}). \
19461942
If you were trying to specify a specific git revision, \
1947-
use `rev = \"{}\"` in the dependency declaration.",
1948-
fragment, name_in_toml, fragment
1943+
use `rev = \"{fragment}\"` in the dependency declaration.",
19491944
);
1950-
manifest_ctx.warnings.push(msg)
1945+
manifest_ctx.warnings.push(msg);
19511946
}
19521947

19531948
SourceId::for_git(&loc, reference)?

0 commit comments

Comments
 (0)