summaryrefslogtreecommitdiff
path: root/cli/npm/resolution
diff options
context:
space:
mode:
Diffstat (limited to 'cli/npm/resolution')
-rw-r--r--cli/npm/resolution/mod.rs4
-rw-r--r--cli/npm/resolution/snapshot.rs2
-rw-r--r--cli/npm/resolution/specifier.rs12
3 files changed, 8 insertions, 10 deletions
diff --git a/cli/npm/resolution/mod.rs b/cli/npm/resolution/mod.rs
index ed194bbac..407651ccb 100644
--- a/cli/npm/resolution/mod.rs
+++ b/cli/npm/resolution/mod.rs
@@ -112,7 +112,7 @@ impl NpmPackageId {
let (input, version) = parse_version(input)?;
match NpmVersion::parse(version) {
Ok(version) => Ok((input, (name.to_string(), version))),
- Err(err) => ParseError::fail(at_version_input, format!("{:#}", err)),
+ Err(err) => ParseError::fail(at_version_input, format!("{err:#}")),
}
}
@@ -173,7 +173,7 @@ impl NpmPackageId {
}
with_failure_handling(parse_id_at_level(0))(id)
- .with_context(|| format!("Invalid npm package id '{}'.", id))
+ .with_context(|| format!("Invalid npm package id '{id}'."))
}
pub fn display(&self) -> String {
diff --git a/cli/npm/resolution/snapshot.rs b/cli/npm/resolution/snapshot.rs
index ad6aee6d9..be64ea611 100644
--- a/cli/npm/resolution/snapshot.rs
+++ b/cli/npm/resolution/snapshot.rs
@@ -247,7 +247,7 @@ impl NpmResolutionSnapshot {
// collect the specifiers to version mappings
for (key, value) in &lockfile.content.npm.specifiers {
let package_req = NpmPackageReq::from_str(key)
- .with_context(|| format!("Unable to parse npm specifier: {}", key))?;
+ .with_context(|| format!("Unable to parse npm specifier: {key}"))?;
let package_id = NpmPackageId::from_serialized(value)?;
package_reqs.insert(package_req, package_id.clone());
verify_ids.insert(package_id.clone());
diff --git a/cli/npm/resolution/specifier.rs b/cli/npm/resolution/specifier.rs
index 6667c60dd..0aa693472 100644
--- a/cli/npm/resolution/specifier.rs
+++ b/cli/npm/resolution/specifier.rs
@@ -47,7 +47,7 @@ impl NpmPackageReference {
let parts = specifier.split('/').collect::<Vec<_>>();
let name_part_len = if specifier.starts_with('@') { 2 } else { 1 };
if parts.len() < name_part_len {
- return Err(generic_error(format!("Not a valid package: {}", specifier)));
+ return Err(generic_error(format!("Not a valid package: {specifier}")));
}
let name_parts = &parts[0..name_part_len];
let last_name_part = &name_parts[name_part_len - 1];
@@ -81,8 +81,7 @@ impl NpmPackageReference {
if let Some(at_index) = sub_path.rfind('@') {
let (new_sub_path, version) = sub_path.split_at(at_index);
let msg = format!(
- "Invalid package specifier 'npm:{}/{}'. Did you mean to write 'npm:{}{}/{}'?",
- name, sub_path, name, version, new_sub_path
+ "Invalid package specifier 'npm:{name}/{sub_path}'. Did you mean to write 'npm:{name}{version}/{new_sub_path}'?"
);
return Err(generic_error(msg));
}
@@ -90,8 +89,7 @@ impl NpmPackageReference {
if name.is_empty() {
let msg = format!(
- "Invalid npm specifier '{}'. Did not contain a package name.",
- original_text
+ "Invalid npm specifier '{original_text}'. Did not contain a package name."
);
return Err(generic_error(msg));
}
@@ -133,7 +131,7 @@ impl std::fmt::Display for NpmPackageReq {
impl NpmPackageReq {
pub fn from_str(text: &str) -> Result<Self, AnyError> {
// probably should do something more targeted in the future
- let reference = NpmPackageReference::from_str(&format!("npm:{}", text))?;
+ let reference = NpmPackageReference::from_str(&format!("npm:{text}"))?;
Ok(reference.req)
}
}
@@ -163,7 +161,7 @@ impl NpmVersionMatcher for NpmPackageReq {
self
.version_req
.as_ref()
- .map(|v| format!("{}", v))
+ .map(|v| format!("{v}"))
.unwrap_or_else(|| "non-prerelease".to_string())
}
}