Skip to content

Commit

Permalink
cargo clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazariglez committed Jun 8, 2024
1 parent b6d3420 commit 5d3ac6f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
6 changes: 3 additions & 3 deletions xtask/src/cli_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ impl Docs {
}

fn docs_clean() -> Result<(), DynError> {
let _ = fs::remove_dir_all(&dist_doc_dir());
fs::create_dir_all(&dist_doc_dir())?;
let _ = fs::remove_dir_all(dist_doc_dir());
fs::create_dir_all(dist_doc_dir())?;

Ok(())
}
Expand All @@ -25,7 +25,7 @@ fn docs_run() -> Result<(), DynError> {
let cargo = env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());
let status = Command::new(cargo)
.current_dir(project_root())
.args(&["doc", "--all-features"])
.args(["doc", "--all-features"])
.status()?;

if !status.success() {
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/cli_example_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Example {
let name_str = self.name.as_str();
let executable = format!("{name_str}.exe");

let _ = fs::create_dir_all(&docs_msvc_dir(self.release))?;
fs::create_dir_all(docs_msvc_dir(self.release))?;
let _ = fs::copy(
dist_msvc_dir(self.release).join(executable.as_str()),
docs_msvc_dir(self.release).join(executable.as_str()),
Expand Down
3 changes: 1 addition & 2 deletions xtask/src/cli_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Examples {
let is_hidden = entry
.file_name()
.to_str()
.map(|name| name.starts_with("."))
.map(|name| name.starts_with('.'))
.unwrap_or_default();
let is_valid = is_file && !is_hidden;
if is_valid {
Expand All @@ -33,7 +33,6 @@ impl Examples {
None
}
})
.into_iter()
.map(|entry| entry.path())
.collect();

Expand Down
14 changes: 6 additions & 8 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ fn copy_assets(to: PathBuf) {
.overwrite(true)
.copy_inside(true);

let mut paths = Vec::new();
paths.push(assets_dir().as_path().to_owned());

let paths = vec![assets_dir().as_path().to_owned()];
let _ = fs_extra::copy_items(&paths, to, &options);
}

Expand All @@ -72,7 +70,7 @@ fn cargo_build(target: TargetType, profile: &str, name: &str) -> Result<ExitStat
match target {
TargetType::Msvc => Command::new(cargo)
.current_dir(project_root())
.args(&[
.args([
"build",
"--target",
"x86_64-pc-windows-msvc",
Expand All @@ -87,7 +85,7 @@ fn cargo_build(target: TargetType, profile: &str, name: &str) -> Result<ExitStat
TargetType::Web => Command::new(cargo)
.current_dir(project_root())
.env("RUSTFLAGS", "--cfg=web_sys_unstable_apis")
.args(&[
.args([
"build",
"--target",
"wasm32-unknown-unknown",
Expand All @@ -108,8 +106,8 @@ fn wasm_bindgen(input: &str, output: &str, debug: bool) -> Result<ExitStatus, Er
&[
[input, "--out-dir", output, "--no-modules", "--browser"].as_slice(),
match debug {
true => &["--keep-debug", "--debug"].as_slice(),
false => &[].as_slice(),
true => ["--keep-debug", "--debug"].as_slice(),
false => [].as_slice(),
},
]
.concat(),
Expand All @@ -120,7 +118,7 @@ fn wasm_bindgen(input: &str, output: &str, debug: bool) -> Result<ExitStatus, Er
fn wasm_opt(input: &str, output: &str) -> Result<ExitStatus, Error> {
Command::new("wasm-opt")
.current_dir(project_root())
.args(&["-O", "-o", input, output])
.args(["-O", "-o", input, output])
.status()
}

Expand Down

0 comments on commit 5d3ac6f

Please sign in to comment.