Skip to content

Commit 9617dac

Browse files
committed
Fix clippy warnings
This also removes part of the test suite because pietro told me to. It was causing an error I don't understand: ``` [INFO rustwide::cmd] running `Command { std: "docker" "start" "-a" "aa0794c5521d231481ac2c06a84ed33417ee7733cd94c06317744a107202ac1b", kill_on_drop: false }` [INFO rustwide::cmd] [stderr] Compiling out-of-memory v0.1.0 (/opt/rustwide/workdir) [INFO rustwide::cmd] [stderr] error: linker `cc` not found [INFO rustwide::cmd] [stderr] | [INFO rustwide::cmd] [stderr] = note: No such file or directory (os error 2) [INFO rustwide::cmd] [stderr] [INFO rustwide::cmd] [stderr] error: aborting due to previous error [INFO rustwide::cmd] [stderr] [INFO rustwide::cmd] [stderr] error: could not compile `out-of-memory` ```
1 parent 76a2475 commit 9617dac

File tree

11 files changed

+13
-18
lines changed

11 files changed

+13
-18
lines changed

examples/docs-builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use env_logger;
21
use rustwide::{cmd::SandboxBuilder, Crate, Toolchain, WorkspaceBuilder};
32
use std::error::Error;
43
use std::path::Path;

src/cmd/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl<'w, 'pl> Command<'w, 'pl> {
356356
/// is by default) the output will be also logged. You can disable this behavior by calling the
357357
/// [`log_output`](struct.Command.html#method.log_output) method.
358358
pub fn run_capture(self) -> Result<ProcessOutput, CommandError> {
359-
Ok(self.run_inner(true)?)
359+
self.run_inner(true)
360360
}
361361

362362
fn run_inner(self, capture: bool) -> Result<ProcessOutput, CommandError> {
@@ -371,8 +371,7 @@ impl<'w, 'pl> Command<'w, 'pl> {
371371
}
372372
};
373373

374-
let mut cmd = Vec::new();
375-
cmd.push(binary.to_string_lossy().as_ref().to_string());
374+
let mut cmd = vec![binary.to_string_lossy().as_ref().to_string()];
376375

377376
for arg in self.args {
378377
cmd.push(arg.to_string_lossy().to_string());

src/cmd/process_lines_actions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ mod test {
5454
fn test_replace() {
5555
let mut actions = ProcessLinesActions::new();
5656

57-
actions.replace_with_lines("ipsum".split("\n"));
57+
actions.replace_with_lines("ipsum".split('\n'));
5858
assert_eq!(
5959
actions.take_lines(),
6060
InnerState::Replaced(vec!["ipsum".to_string()])
6161
);
6262

63-
actions.replace_with_lines("lorem ipsum dolor".split(" "));
63+
actions.replace_with_lines("lorem ipsum dolor".split(' '));
6464
assert_eq!(
6565
actions.take_lines(),
6666
InnerState::Replaced(vec![

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![warn(missing_docs)]
22
#![allow(clippy::new_without_default)]
3+
#![allow(clippy::upper_case_acronyms)]
34
#![cfg_attr(docs_rs, feature(doc_cfg))]
45

56
//! Rustwide is a library to execute your code on the Rust ecosystem, powering projects like

src/native/unix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub(crate) fn kill_process(id: u32) -> Result<(), KillFailedError> {
2525
}
2626
}
2727

28+
#[allow(clippy::unnecessary_wraps)] // the API is intentionally the same as `windows::current_user`
2829
pub(crate) fn current_user() -> Option<CurrentUser> {
2930
Some(CurrentUser {
3031
user_id: Uid::effective().into(),

src/tools/binary_crates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Tool for BinaryCrate {
4444
return Ok(false);
4545
}
4646

47-
Ok(crate::native::is_executable(path)?)
47+
crate::native::is_executable(path)
4848
}
4949

5050
fn install(&self, workspace: &Workspace, fast_install: bool) -> Result<(), Error> {

src/tools/rustup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Tool for Rustup {
2929
return Ok(false);
3030
}
3131

32-
Ok(crate::native::is_executable(path)?)
32+
crate::native::is_executable(path)
3333
}
3434

3535
fn install(&self, workspace: &Workspace, _fast_install: bool) -> Result<(), Error> {

src/workspace.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ impl Workspace {
317317
Ok(())
318318
}
319319

320+
#[allow(clippy::unnecessary_wraps)] // hopefully we could actually catch the error here at some point
320321
fn update_cratesio_registry(&self) -> Result<(), Error> {
321322
// This nop cargo command is to update the registry so we don't have to do it for each
322323
// crate. using `install` is a temporary solution until

tests/buildtest/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn test_process_lines() {
3838
.process_lines(&mut |line: &str, actions: &mut ProcessLinesActions| {
3939
if line.contains("Hello, world again!") {
4040
ex = true;
41-
actions.replace_with_lines(line.split(","));
41+
actions.replace_with_lines(line.split(','));
4242
} else if line.contains("Hello, world!") {
4343
actions.remove_line();
4444
}

tests/integration/crates_git.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ fn test_fetch() -> Result<(), Error> {
1616
let cloned_commit = || -> Result<String, Error> {
1717
let mut dir = workspace.build_dir("integration-crates_git-test_fetch");
1818
dir.purge()?;
19-
Ok(dir
20-
.build(&toolchain, &krate, SandboxBuilder::new())
19+
dir.build(&toolchain, &krate, SandboxBuilder::new())
2120
.run(|build| {
2221
Ok(Command::new(&workspace, "git")
2322
.args(&["rev-parse", "HEAD"])
2423
.cd(build.host_source_dir())
2524
.run_capture()?
2625
.stdout_lines()[0]
2726
.to_string())
28-
})?)
27+
})
2928
};
3029

3130
// Check if the initial commit was fetched

0 commit comments

Comments
 (0)