summaryrefslogtreecommitdiff
path: root/cli/util/path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/util/path.rs')
-rw-r--r--cli/util/path.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/cli/util/path.rs b/cli/util/path.rs
index 76e2a1b6f..d073d80bd 100644
--- a/cli/util/path.rs
+++ b/cli/util/path.rs
@@ -64,8 +64,7 @@ pub fn specifier_to_file_path(
match result {
Ok(path) => Ok(path),
Err(()) => Err(uri_error(format!(
- "Invalid file path.\n Specifier: {}",
- specifier
+ "Invalid file path.\n Specifier: {specifier}"
))),
}
}
@@ -76,7 +75,7 @@ pub fn ensure_directory_specifier(
) -> ModuleSpecifier {
let path = specifier.path();
if !path.ends_with('/') {
- let new_path = format!("{}/", path);
+ let new_path = format!("{path}/");
specifier.set_path(&new_path);
}
specifier
@@ -135,7 +134,7 @@ pub fn relative_specifier(
Some(if text.starts_with("../") || text.starts_with("./") {
text
} else {
- format!("./{}", text)
+ format!("./{text}")
})
}
@@ -170,12 +169,12 @@ pub fn path_with_stem_suffix(path: &Path, suffix: &str) -> PathBuf {
ext
))
} else {
- path.with_file_name(format!("{}{}.{}", file_stem, suffix, ext))
+ path.with_file_name(format!("{file_stem}{suffix}.{ext}"))
};
}
}
- path.with_file_name(format!("{}{}", file_name, suffix))
+ path.with_file_name(format!("{file_name}{suffix}"))
} else {
path.with_file_name(suffix)
}
@@ -380,9 +379,7 @@ mod test {
assert_eq!(
actual.as_deref(),
expected,
- "from: \"{}\" to: \"{}\"",
- from_str,
- to_str
+ "from: \"{from_str}\" to: \"{to_str}\""
);
}
}