From f5840bdcd360ec0bac2501f333e58e25742b1537 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 27 Jan 2023 10:43:16 -0500 Subject: chore: upgrade to Rust 1.67 (#17548) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartek IwaƄczuk --- cli/npm/semver/mod.rs | 18 +++++++----------- cli/npm/semver/specifier.rs | 4 ++-- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'cli/npm/semver') diff --git a/cli/npm/semver/mod.rs b/cli/npm/semver/mod.rs index a87585809..b532835e6 100644 --- a/cli/npm/semver/mod.rs +++ b/cli/npm/semver/mod.rs @@ -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 { 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 { 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 { 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}" ); } } diff --git a/cli/npm/semver/specifier.rs b/cli/npm/semver/specifier.rs index 3fdeab16d..b12a5c308 100644 --- a/cli/npm/semver/specifier.rs +++ b/cli/npm/semver/specifier.rs @@ -33,7 +33,7 @@ impl std::fmt::Display for SpecifierVersionReq { impl SpecifierVersionReq { pub fn parse(text: &str) -> Result { 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 { Err(err) => { return ParseError::fail( input, - format!("Error parsing '{}' to u64.\n\n{:#}", result, err), + format!("Error parsing '{result}' to u64.\n\n{err:#}"), ) } }; -- cgit v1.2.3