Skip to content

Commit c2efb04

Browse files
committed
fix: clippy 1.97 -D warnings (useless borrows, needless return?)
CI stable is 1.97; RUSTFLAGS=-D warnings fails on pre-existing useless_borrows_in_formatting and needless_return_with_question_mark.
1 parent 642d8e5 commit c2efb04

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎crates/cli/src/resolve.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub async fn resolve(
8787
let mut installations = resolution.installed;
8888
if !resolution.pending.is_empty() {
8989
if env::var("PKGX_NO_INSTALL").is_ok() {
90-
return Err("PKGX_NO_INSTALL is set, refusing to install pending packages")?;
90+
Err("PKGX_NO_INSTALL is set, refusing to install pending packages")?;
9191
}
9292
let installed = install_multi(&resolution.pending, config, spinner.arc()).await?;
9393
installations.extend(installed);

‎crates/lib/src/env.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub fn expand_moustaches(input: &str, pkg: &Installation, deps: &Vec<Installatio
211211
}
212212

213213
output = output.replace("{{prefix}}", &pkg.path.to_string_lossy());
214-
output = output.replace("{{version}}", &format!("{}", &pkg.pkg.version));
214+
output = output.replace("{{version}}", &format!("{}", pkg.pkg.version));
215215
output = output.replace("{{version.major}}", &format!("{}", pkg.pkg.version.major));
216216
output = output.replace("{{version.minor}}", &format!("{}", pkg.pkg.version.minor));
217217
output = output.replace("{{version.patch}}", &format!("{}", pkg.pkg.version.patch));
@@ -228,7 +228,7 @@ pub fn expand_moustaches(input: &str, pkg: &Installation, deps: &Vec<Installatio
228228
);
229229
output = output.replace(
230230
&format!("{{{{{}.version}}}}", prefix),
231-
&format!("{}", &dep.pkg.version),
231+
&format!("{}", dep.pkg.version),
232232
);
233233
output = output.replace(
234234
&format!("{{{{{}.version.major}}}}", prefix),

‎crates/lib/src/sync.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub async fn update(config: &Config, conn: &mut Connection) -> Result<(), Box<dy
3939
FileExt::unlock(&lockfile)?;
4040
return Ok(());
4141
} else {
42-
return Err(
42+
Err(
4343
"PKGX_PANTRY_DIR is set but does not contain a pantry (missing projects/)",
4444
)?;
4545
}

‎crates/lib/src/types.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct Package {
1919

2020
impl fmt::Display for Package {
2121
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22-
write!(f, "{}={}", self.project, &self.version)
22+
write!(f, "{}={}", self.project, self.version)
2323
}
2424
}
2525

@@ -63,7 +63,7 @@ impl fmt::Display for PackageReq {
6363
if self.constraint.raw == "*" {
6464
write!(f, "{}", self.project)
6565
} else {
66-
write!(f, "{}{}", self.project, &self.constraint)
66+
write!(f, "{}{}", self.project, self.constraint)
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)