Skip to content

Commit f25d523

Browse files
committed
apease clippy
1 parent 326ed9f commit f25d523

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() -> Result<(), Box<dyn Error>> {
88
let target = std::env::var("TARGET")?;
99

1010
let output = std::env::var("OUT_DIR")?;
11-
::std::fs::write(format!("{}/target", output), target.as_bytes())?;
11+
::std::fs::write(format!("{output}/target"), target.as_bytes())?;
1212

1313
println!("cargo:rerun-if-env-changed=DOCS_RS");
1414
if std::env::var_os("DOCS_RS").as_deref() == Some(std::ffi::OsStr::new("1")) {

src/cmd/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,14 @@ impl<'w, 'pl> Command<'w, 'pl> {
501501
cmd.env(k, v);
502502
}
503503

504-
let cmdstr = format!("{:?}", cmd);
504+
let cmdstr = format!("{cmd:?}");
505505

506506
if let Some(ref cd) = self.cd {
507507
cmd.current_dir(cd);
508508
}
509509

510510
if self.log_command {
511-
info!("running `{}`", cmdstr);
511+
info!("running `{cmdstr}`");
512512
}
513513

514514
let out = RUNTIME
@@ -521,7 +521,7 @@ impl<'w, 'pl> Command<'w, 'pl> {
521521
self.log_output,
522522
))
523523
.map_err(|e| {
524-
error!("error running command: {}", e);
524+
error!("error running command: {e}");
525525
e
526526
})?;
527527

src/cmd/sandbox.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl SandboxImage {
2929
/// error will be returned instead.
3030
pub fn remote(name: &str) -> Result<Self, CommandError> {
3131
let mut image = SandboxImage { name: name.into() };
32-
info!("pulling image {} from Docker Hub", name);
32+
info!("pulling image {name} from Docker Hub");
3333
Command::new_workspaceless("docker")
3434
.args(&["pull", name])
3535
.run()
@@ -219,7 +219,7 @@ impl SandboxBuilder {
219219
}
220220

221221
pub(super) fn user(mut self, user: u32, group: u32) -> Self {
222-
self.user = Some(format!("{}:{}", user, group));
222+
self.user = Some(format!("{user}:{group}"));
223223
self
224224
}
225225

@@ -242,7 +242,7 @@ impl SandboxBuilder {
242242

243243
for (var, value) in &self.env {
244244
args.push("-e".into());
245-
args.push(format! {"{}={}", var, value})
245+
args.push(format! {"{var}={value}"})
246246
}
247247

248248
if let Some(workdir) = self.workdir {
@@ -308,10 +308,10 @@ impl SandboxBuilder {
308308
scopeguard::defer! {{
309309
if let Err(err) = container.delete() {
310310
error!("failed to delete container {}", container.id);
311-
error!("caused by: {}", err);
311+
error!("caused by: {err}");
312312
let mut err: &dyn Error = &err;
313313
while let Some(cause) = err.source() {
314-
error!("caused by: {}", cause);
314+
error!("caused by: {cause}");
315315
err = cause;
316316
}
317317
}

src/crates/registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl RegistryCrate {
122122
git2::build::RepoBuilder::new()
123123
.fetch_options(fo)
124124
.clone(url, &index_path)
125-
.with_context(|| format!("unable to update_index at {}", url))?;
125+
.with_context(|| format!("unable to update_index at {url}"))?;
126126
info!("cloned registry index");
127127
}
128128
let config = std::fs::read_to_string(index_path.join("config.json"))?;

src/inside_docker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub(crate) fn probe_container_id(workspace: &Workspace) -> anyhow::Result<Option
6262
.log_command(false)
6363
.run_capture()?;
6464
for id in out.stdout_lines() {
65-
info!("probing container id {}", id);
65+
info!("probing container id {id}");
6666

6767
let res = Command::new(workspace, "docker")
6868
.args(&["exec", id, "cat", probe_path_str])
@@ -71,7 +71,7 @@ pub(crate) fn probe_container_id(workspace: &Workspace) -> anyhow::Result<Option
7171
.run_capture();
7272
if let Ok([probed]) = res.as_ref().map(|out| out.stdout_lines()) {
7373
if *probed == probe_content {
74-
info!("probe successful, this is container ID {}", id);
74+
info!("probe successful, this is container ID {id}");
7575
return Ok(Some(id.clone()));
7676
}
7777
}

src/prepare.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl<'a> TomlTweaker<'a> {
268268
// Eliminate parent workspaces
269269
if let Some(&mut Value::Table(ref mut package)) = self.table.get_mut("package") {
270270
if package.remove("workspace").is_some() {
271-
info!("removed parent workspace from {}", krate);
271+
info!("removed parent workspace from {krate}");
272272
}
273273
}
274274
}
@@ -295,15 +295,15 @@ impl<'a> TomlTweaker<'a> {
295295

296296
// Strip the 'publish-lockfile' key from [package]
297297
if has_publish_lockfile {
298-
info!("disabled cargo feature 'publish-lockfile' from {}", krate);
298+
info!("disabled cargo feature 'publish-lockfile' from {krate}");
299299
if let Some(&mut Value::Table(ref mut package)) = self.table.get_mut("package") {
300300
package.remove("publish-lockfile");
301301
}
302302
}
303303

304304
// Strip the 'default-run' key from [package]
305305
if has_default_run {
306-
info!("disabled cargo feature 'default-run' from {}", krate);
306+
info!("disabled cargo feature 'default-run' from {krate}");
307307
if let Some(&mut Value::Table(ref mut package)) = self.table.get_mut("package") {
308308
package.remove("default-run");
309309
}
@@ -390,6 +390,7 @@ pub enum PrepareError {
390390
/// Some of the dependencies do not exist anymore.
391391
#[error("the crate depends on missing dependencies: \n\n{0}")]
392392
MissingDependencies(String),
393+
/// Some not further detaild error
393394
#[error("prepare failed without further details")]
394395
Unknown,
395396
}

src/toolchain.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,7 @@ impl Toolchain {
407407
.collect()),
408408
Err(_) if not_installed => Err(ToolchainError::NotInstalled.into()),
409409
Err(err) => Err(anyhow!(err).context(format!(
410-
"failed to read the list of installed {}s for {} with rustup",
411-
thing, name
410+
"failed to read the list of installed {thing}s for {name} with rustup"
412411
))),
413412
}
414413
}
@@ -419,7 +418,7 @@ impl Toolchain {
419418
Command::new(workspace, &RUSTUP)
420419
.args(&["toolchain", "uninstall", &name])
421420
.run()
422-
.with_context(|| format!("unable to uninstall toolchain {} via rustup", name))?;
421+
.with_context(|| format!("unable to uninstall toolchain {name} via rustup"))?;
423422
Ok(())
424423
}
425424

src/tools/rustup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Tool for Rustup {
4949
.error_for_status()?;
5050

5151
let tempdir = tempdir()?;
52-
let installer = &tempdir.path().join(format!("rustup-init{}", EXE_SUFFIX));
52+
let installer = &tempdir.path().join(format!("rustup-init{EXE_SUFFIX}"));
5353
{
5454
let mut file = File::create(installer)?;
5555
io::copy(&mut resp, &mut file)?;
@@ -81,7 +81,7 @@ impl Tool for Rustup {
8181
Command::new(workspace, &RUSTUP)
8282
.args(&["update", MAIN_TOOLCHAIN_NAME])
8383
.run()
84-
.with_context(|| format!("failed to update main toolchain {}", MAIN_TOOLCHAIN_NAME))?;
84+
.with_context(|| format!("failed to update main toolchain {MAIN_TOOLCHAIN_NAME}"))?;
8585
Ok(())
8686
}
8787
}

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) fn file_lock<T>(
3535
let mut message_displayed = false;
3636
while let Err(err) = file.try_lock_exclusive() {
3737
if !message_displayed && err.kind() == fs2::lock_contended_error().kind() {
38-
warn!("blocking on other processes finishing to {}", msg);
38+
warn!("blocking on other processes finishing to {msg}");
3939
message_displayed = true;
4040
}
4141
file.lock_exclusive()?;

0 commit comments

Comments
 (0)