mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
1a1faff2f6
commit
f5840bdcd3
148 changed files with 576 additions and 681 deletions
|
@ -216,7 +216,7 @@ impl ReadonlyNpmCache {
|
|||
let encoded_name = mixed_case_package_name_encode(name);
|
||||
// Using the encoded directory may have a collision with an actual package name
|
||||
// so prefix it with an underscore since npm packages can't start with that
|
||||
dir.join(format!("_{}", encoded_name))
|
||||
dir.join(format!("_{encoded_name}"))
|
||||
} else {
|
||||
// ensure backslashes are used on windows
|
||||
for part in name.split('/') {
|
||||
|
|
|
@ -131,8 +131,7 @@ impl NpmPackageVersionInfo {
|
|||
let version_req =
|
||||
NpmVersionReq::parse(&version_req).with_context(|| {
|
||||
format!(
|
||||
"error parsing version requirement for dependency: {}@{}",
|
||||
bare_specifier, version_req
|
||||
"error parsing version requirement for dependency: {bare_specifier}@{version_req}"
|
||||
)
|
||||
})?;
|
||||
Ok(NpmDependencyEntry {
|
||||
|
@ -369,10 +368,7 @@ impl RealNpmRegistryApiInner {
|
|||
Ok(value) => value,
|
||||
Err(err) => {
|
||||
if cfg!(debug_assertions) {
|
||||
panic!(
|
||||
"error loading cached npm package info for {}: {:#}",
|
||||
name, err
|
||||
);
|
||||
panic!("error loading cached npm package info for {name}: {err:#}");
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -415,10 +411,7 @@ impl RealNpmRegistryApiInner {
|
|||
self.save_package_info_to_file_cache_result(name, package_info)
|
||||
{
|
||||
if cfg!(debug_assertions) {
|
||||
panic!(
|
||||
"error saving cached npm package info for {}: {:#}",
|
||||
name, err
|
||||
);
|
||||
panic!("error saving cached npm package info for {name}: {err:#}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -443,8 +436,7 @@ impl RealNpmRegistryApiInner {
|
|||
return Err(custom_error(
|
||||
"NotCached",
|
||||
format!(
|
||||
"An npm specifier not found in cache: \"{}\", --cached-only is specified.",
|
||||
name
|
||||
"An npm specifier not found in cache: \"{name}\", --cached-only is specified."
|
||||
)
|
||||
));
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,14 +256,13 @@ impl NpmPackageResolver {
|
|||
.iter()
|
||||
.collect::<HashSet<_>>() // prevent duplicates
|
||||
.iter()
|
||||
.map(|p| format!("\"{}\"", p))
|
||||
.map(|p| format!("\"{p}\""))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
return Err(custom_error(
|
||||
"NoNpm",
|
||||
format!(
|
||||
"Following npm specifiers were requested: {}; but --no-npm is specified.",
|
||||
fmt_reqs
|
||||
"Following npm specifiers were requested: {fmt_reqs}; but --no-npm is specified."
|
||||
),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ impl fmt::Display for NpmVersion {
|
|||
if i > 0 {
|
||||
write!(f, ".")?;
|
||||
}
|
||||
write!(f, "{}", part)?;
|
||||
write!(f, "{part}")?;
|
||||
}
|
||||
}
|
||||
if !self.build.is_empty() {
|
||||
|
@ -62,7 +62,7 @@ impl fmt::Display for NpmVersion {
|
|||
if i > 0 {
|
||||
write!(f, ".")?;
|
||||
}
|
||||
write!(f, "{}", part)?;
|
||||
write!(f, "{part}")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
@ -143,7 +143,7 @@ impl NpmVersion {
|
|||
pub fn parse(text: &str) -> Result<Self, AnyError> {
|
||||
let text = text.trim();
|
||||
with_failure_handling(parse_npm_version)(text)
|
||||
.with_context(|| format!("Invalid npm version '{}'.", text))
|
||||
.with_context(|| format!("Invalid npm version '{text}'."))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ impl NpmVersionReq {
|
|||
pub fn parse(text: &str) -> Result<Self, AnyError> {
|
||||
let text = text.trim();
|
||||
with_failure_handling(parse_npm_version_req)(text)
|
||||
.with_context(|| format!("Invalid npm version requirement '{}'.", text))
|
||||
.with_context(|| format!("Invalid npm version requirement '{text}'."))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ fn nr(input: &str) -> ParseResult<u64> {
|
|||
Err(err) => {
|
||||
return ParseError::fail(
|
||||
input,
|
||||
format!("Error parsing '{}' to u64.\n\n{:#}", result, err),
|
||||
format!("Error parsing '{result}' to u64.\n\n{err:#}"),
|
||||
)
|
||||
}
|
||||
};
|
||||
|
@ -984,9 +984,7 @@ mod tests {
|
|||
let version = NpmVersion::parse(version_text).unwrap();
|
||||
assert!(
|
||||
req.matches(&version),
|
||||
"Checking {} satisfies {}",
|
||||
req_text,
|
||||
version_text
|
||||
"Checking {req_text} satisfies {version_text}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1083,9 +1081,7 @@ mod tests {
|
|||
let version = NpmVersion::parse(version_text).unwrap();
|
||||
assert!(
|
||||
!req.matches(&version),
|
||||
"Checking {} not satisfies {}",
|
||||
req_text,
|
||||
version_text
|
||||
"Checking {req_text} not satisfies {version_text}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ impl std::fmt::Display for SpecifierVersionReq {
|
|||
impl SpecifierVersionReq {
|
||||
pub fn parse(text: &str) -> Result<Self, AnyError> {
|
||||
with_failure_handling(parse_npm_specifier)(text).with_context(|| {
|
||||
format!("Invalid npm specifier version requirement '{}'.", text)
|
||||
format!("Invalid npm specifier version requirement '{text}'.")
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ fn nr(input: &str) -> ParseResult<u64> {
|
|||
Err(err) => {
|
||||
return ParseError::fail(
|
||||
input,
|
||||
format!("Error parsing '{}' to u64.\n\n{:#}", result, err),
|
||||
format!("Error parsing '{result}' to u64.\n\n{err:#}"),
|
||||
)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -154,12 +154,12 @@ mod test {
|
|||
verify_tarball_integrity(package, &Vec::new(), "sha512-test")
|
||||
.unwrap_err()
|
||||
.to_string(),
|
||||
format!("Tarball checksum did not match what was provided by npm registry for package@1.0.0.\n\nExpected: test\nActual: {}", actual_checksum),
|
||||
format!("Tarball checksum did not match what was provided by npm registry for package@1.0.0.\n\nExpected: test\nActual: {actual_checksum}"),
|
||||
);
|
||||
assert!(verify_tarball_integrity(
|
||||
package,
|
||||
&Vec::new(),
|
||||
&format!("sha512-{}", actual_checksum)
|
||||
&format!("sha512-{actual_checksum}")
|
||||
)
|
||||
.is_ok());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue