Skip to content

build(deps): bump docker/build-push-action from 2 to 5 #34

build(deps): bump docker/build-push-action from 2 to 5

build(deps): bump docker/build-push-action from 2 to 5 #34

GitHub Actions / clippy succeeded Mar 17, 2024 in 0s

reviewdog [clippy] report

reported by reviewdog 🐶

Findings (0)
Filtered Findings (86)

goldboot/build.rs|3 col 12| warning: unused import: Path
--> goldboot/build.rs:3:12
|
3 | path::{Path, PathBuf},
| ^^^^
|
= note: #[warn(unused_imports)] on by default
goldboot-image/src/lib.rs|445 col 35| warning: unneeded unit return type
--> goldboot-image/src/lib.rs:445:35
|
445 | pub fn convert<F: Fn(u64, u64) -> ()>(
| ^^^^^^ help: remove the -> ()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
= note: #[warn(clippy::unused_unit)] on by default
goldboot-image/src/lib.rs|696 col 33| warning: unneeded unit return type
--> goldboot-image/src/lib.rs:696:33
|
696 | pub fn write<F: Fn(u64, u64) -> ()>(&self, dest: impl AsRef, progress: F) -> Result<()> {
| ^^^^^^ help: remove the -> ()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
goldboot-image/src/qcow/mod.rs|58 col 17| warning: unnecessary use of to_string
--> goldboot-image/src/qcow/mod.rs:58:17
|
58 | &path.to_string_lossy().to_string(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: path.to_string_lossy().as_ref()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
= note: #[warn(clippy::unnecessary_to_owned)] on by default
goldboot-image/src/lib.rs|391 col 28| warning: the borrowed expression implements the required traits
--> goldboot-image/src/lib.rs:391:28
|
391 | compute_id(&path).unwrap()
| ^^^^^ help: change this to: path
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: #[warn(clippy::needless_borrows_for_generic_args)] on by default
goldboot-image/src/lib.rs|394 col 24| warning: the borrowed expression implements the required traits
--> goldboot-image/src/lib.rs:394:24
|
394 | compute_id(&path).unwrap()
| ^^^^^ help: change this to: path
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
goldboot-image/src/lib.rs|418 col 46| warning: the borrowed expression implements the required traits
--> goldboot-image/src/lib.rs:418:46
|
418 | file_size: std::fs::metadata(&path)?.len(),
| ^^^^^ help: change this to: path
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
goldboot-image/src/lib.rs|429 col 46| warning: the borrowed expression implements the required traits
--> goldboot-image/src/lib.rs:429:46
|
429 | file_size: std::fs::metadata(&path)?.len(),
| ^^^^^ help: change this to: path
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
goldboot-image/src/lib.rs|491 col 60| warning: redundant slicing of the whole range
--> goldboot-image/src/lib.rs:491:60
|
491 | primary_header.name[0..name.len()].copy_from_slice(&name.clone().as_bytes()[..]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the original value instead: name.clone().as_bytes()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing
= note: #[warn(clippy::redundant_slicing)] on by default
goldboot-image/src/lib.rs|710 col 14| warning: file opened with create, but truncate behavior not defined
--> goldboot-image/src/lib.rs:710:14
|
710 | .create(true)
| ^^^^^^^^^^^^- help: add: .truncate(true)
|
= help: if you intend to overwrite an existing file entirely, call .truncate(true)
= help: if you instead know that you may want to keep some parts of the old file, call .truncate(false)
= help: alternatively, use .append(true) to append to the file instead of overwriting it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
= note: #[warn(clippy::suspicious_open_options)] on by default
goldboot-image/src/lib.rs|727 col 18| warning: the loop variable i is used to index digest_table
--> goldboot-image/src/lib.rs:727:18
|
727 | for i in 0..protected_header.cluster_count as usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
= note: #[warn(clippy::needless_range_loop)] on by default
help: consider using an iterator and enumerate()
|
727 | for (i, ) in digest_table.iter().enumerate().take(protected_header.cluster_count as usize) {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goldboot-macros/src/lib.rs|3 col 17| warning: unused import: DataStruct
--> goldboot-macros/src/lib.rs:3:17
|
3 | use syn::{self, DataStruct};
| ^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
goldboot-macros/src/lib.rs|14 col 9| warning: unused variable: fields
--> goldboot-macros/src/lib.rs:14:9
|
14 | let fields: Vec = match &ast.data {
| ^^^^^^ help: if this is intentional, prefix it with an underscore: _fields
|
= note: #[warn(unused_variables)] on by default
goldboot-macros/src/lib.rs|3 col 17| warning: unused import: DataStruct
--> goldboot-macros/src/lib.rs:3:17
|
3 | use syn::{self, DataStruct};
| ^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
goldboot-macros/src/lib.rs|14 col 9| warning: unused variable: fields
--> goldboot-macros/src/lib.rs:14:9
|
14 | let fields: Vec = match &ast.data {
| ^^^^^^ help: if this is intentional, prefix it with an underscore: _fields
|
= note: #[warn(unused_variables)] on by default
goldboot/src/cli/cmd/write.rs|36 col 13| warning: this if statement can be collapsed
--> goldboot/src/cli/cmd/write.rs:36:13
|
36 | / if Path::new(&output).exists() && !confirm {
37 | | if !Confirm::with_theme(&theme)
38 | | .with_prompt("Do you want to continue?")
39 | | .interact()
... |
43 | | }
44 | | }
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: #[warn(clippy::collapsible_if)] on by default
help: collapse nested if block
|
36 ~ if Path::new(&output).exists() && !confirm && !Confirm::with_theme(&theme)
37 + .with_prompt("Do you want to continue?")
38 + .interact()
39 + .unwrap() {
40 + std::process::exit(0);
41 + }
|
goldboot/src/foundry/fabricators/ansible.rs|67 col 9| warning: this if statement can be collapsed
--> goldboot/src/foundry/fabricators/ansible.rs:67:9
|
67 | / if !Path::new(&self.playbook).exists() {
68 | | if !dialoguer::Confirm::with_theme(&*theme)
69 | | .with_prompt("The path does not exist. Add anyway?")
70 | | .interact()?
... |
73 | | }
74 | | }
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
67 ~ if !Path::new(&self.playbook).exists() && !dialoguer::Confirm::with_theme(&*theme)
68 + .with_prompt("The path does not exist. Add anyway?")
69 + .interact()? {
70 + bail!("The playbook did not exist");
71 + }
|
goldboot/src/foundry/fabricators/exe.rs|36 col 9| warning: this if statement can be collapsed
--> goldboot/src/foundry/fabricators/exe.rs:36:9
|
36 | / if !Path::new(&self.path).exists() {
37 | | if !dialoguer::Confirm::with_theme(&*theme)
38 | | .with_prompt("The path does not exist. Add anyway?")
39 | | .interact()?
... |
42 | | }
43 | | }
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
36 ~ if !Path::new(&self.path).exists() && !dialoguer::Confirm::with_theme(&*theme)
37 + .with_prompt("The path does not exist. Add anyway?")
38 + .interact()? {
39 + bail!("The playbook did not exist");
40 + }
|
goldboot/src/foundry/http.rs|3 col 11| warning: unused import: collections::HashMap
--> goldboot/src/foundry/http.rs:3:11
|
3 | use std::{collections::HashMap, path::Path};
| ^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
goldboot/src/foundry/http.rs|7 col 16| warning: unused import: ServeDir
--> goldboot/src/foundry/http.rs:7:16
|
7 | services::{ServeDir, ServeFile},
| ^^^^^^^^
goldboot/src/foundry/molds/debian/mod.rs|18 col 12| warning: unused import: wait
--> goldboot/src/foundry/molds/debian/mod.rs:18:12
|
18 | input, wait, wait_screen, wait_screen_rect,
| ^^^^
goldboot/src/foundry/sources/mod.rs|73 col 13| warning: this if statement can be collapsed
--> goldboot/src/foundry/sources/mod.rs:73:13
|
73 | / if path.is_file() {
74 | | if !Self::verify_checksum(path.to_string_lossy().to_string(), checksum.as_str())
75 | | .is_ok()
76 | | {
... |
79 | | }
80 | | }
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
73 ~ if path.is_file() && !Self::verify_checksum(path.to_string_lossy().to_string(), checksum.as_str())
74 + .is_ok() {
75 + info!("Deleting corrupt cached file");
76 + std::fs::remove_file(&path)?;
77 + }
|
goldboot/src/foundry/ssh.rs|11 col 5| warning: unused import: std::thread::sleep
--> goldboot/src/foundry/ssh.rs:11:5
|
11 | use std::thread::sleep;
| ^^^^^^^^^^^^^^^^^^
goldboot/src/foundry/vnc.rs|409 col 17| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:409:17
|
409 | crate::foundry::vnc::VncCmd::Type($text.to_string()),
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
= note: #[warn(clippy::crate_in_macro_def)] on by default
goldboot/src/foundry/vnc.rs|426 col 17| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:426:17
|
426 | crate::foundry::vnc::VncCmd::Spacebar,
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|436 col 17| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:436:17
|
436 | crate::foundry::vnc::VncCmd::Escape,
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|446 col 17| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:446:17
|
446 | crate::foundry::vnc::VncCmd::Type($text.to_string()),
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|462 col 18| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:462:18
|
462 | vec![crate::foundry::vnc::VncCmd::Wait($duration)]
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|469 col 18| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:469:18
|
469 | vec![crate::foundry::vnc::VncCmd::WaitScreen($hash.to_string())]
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|476 col 18| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:476:18
|
476 | vec![crate::foundry::vnc::VncCmd::WaitScreenRect(
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|490 col 17| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:490:17
|
490 | crate::foundry::vnc::VncCmd::Type($text.to_string()),
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/foundry/vnc.rs|500 col 17| warning: crate references the macro call's crate
--> goldboot/src/foundry/vnc.rs:500:17
|
500 | crate::foundry::vnc::VncCmd::LeftSuper,
| ^^^^^ help: to reference the macro definition's crate, use: $crate
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#crate_in_macro_def
goldboot/src/cli/cmd/image.rs|21 col 30| warning: use of deprecated method chrono::TimeZone::timestamp: use timestamp_opt() instead
--> goldboot/src/cli/cmd/image.rs:21:30
|
21 | ... .timestamp(image.primary_header.timestamp as i64, 0)
| ^^^^^^^^^
|
= note: #[warn(deprecated)] on by default
goldboot/src/cli/cmd/cast.rs|13 col 13| warning: unused variable: no_accel
--> goldboot/src/cli/cmd/cast.rs:13:13
|
13 | no_accel,
| ^^^^^^^^ help: try ignoring the field: no_accel: _
|
= note: #[warn(unused_variables)] on by default
goldboot/src/cli/cmd/cast.rs|48 col 21| warning: unused variable: err
--> goldboot/src/cli/cmd/cast.rs:48:21
|
48 | Err(err) => {
| ^^^ help: if this is intentional, prefix it with an underscore: _err
goldboot/src/foundry/molds/debian/mod.rs|140 col 13| warning: variable does not need to be mutable
--> goldboot/src/foundry/molds/debian/mod.rs:140:13
|
140 | let mut ssh = qemu.ssh("root")?;
| ----^^^
| |
| help: remove this mut
|
= note: #[warn(unused_mut)] on by default
goldboot/src/foundry/qemu.rs|312 col 17| warning: variable does not need to be mutable
--> goldboot/src/foundry/qemu.rs:312:17
|
312 | let mut fs_file = OpenOptions::new()
| ----^^^^^^^
| |
| help: remove this mut
goldboot/src/foundry/qemu.rs|325 col 17| warning: variable does not need to be mutable
--> goldboot/src/foundry/qemu.rs:325:17
|
325 | let mut fs_file = OpenOptions::new()
| ----^^^^^^^
| |
| help: remove this mut
goldboot/src/foundry/ssh.rs|54 col 9| warning: variable does not need to be mutable
--> goldboot/src/foundry/ssh.rs:54:9
|
54 | let mut uncompressed = flate2::read::GzDecoder::new(response);
| ----^^^^^^^^^^^^
| |
| help: remove this mut
goldboot/src/foundry/molds/arch_linux/mod.rs|174 col 4| warning: function fetch_latest_iso is never used
--> goldboot/src/foundry/molds/arch_linux/mod.rs:174:4
|
174 | fn fetch_latest_iso() -> Result {
| ^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
goldboot/src/foundry/qemu.rs|199 col 12| warning: field temp is never read
--> goldboot/src/foundry/qemu.rs:208:5
|
199 | pub struct QemuBuilder {
| ----------- field in this struct
...
208 | temp: PathBuf,
| ^^^^
goldboot/src/cli/cmd/image.rs|24 col 25| warning: literal with an empty format string
--> goldboot/src/cli/cmd/image.rs:24:25
|
24 | "TODO",
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
= note: #[warn(clippy::print_literal)] on by default
help: try
|
17 ~ "{:15} {:12} {:31} {:12} TODO",
18 | std::str::from_utf8(&image.primary_header.name).unwrap(),
...
22 | .to_rfc2822(),
23 ~ &image.id[0..12],
|
goldboot/src/cli/cmd/init.rs|19 col 24| warning: literal with an empty format string
--> goldboot/src/cli/cmd/init.rs:19:24
|
19 | println!("{}", "");
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
help: try
|
19 - println!("{}", "");
19 + println!("");
|
goldboot/src/cli/cmd/init.rs|23 col 24| warning: literal with an empty format string
--> goldboot/src/cli/cmd/init.rs:23:24
|
23 | println!("{}", "");
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
help: try
|
23 - println!("{}", "");
23 + println!("");
|
goldboot/src/cli/cmd/init.rs|46 col 16| warning: length comparison to zero
--> goldboot/src/cli/cmd/init.rs:46:16
|
46 | if mold.len() > 0 {
| ^^^^^^^^^^^^^^ help: using !is_empty is clearer and more explicit: !mold.is_empty()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: #[warn(clippy::len_zero)] on by default
goldboot/src/cli/cmd/init.rs|91 col 32| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/cli/cmd/init.rs:91:32
|
91 | .items(&formats)
| ^^^^^^^^ help: change this to: formats
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: #[warn(clippy::needless_borrow)] on by default
goldboot/src/cli/cmd/init.rs|144 col 40| warning: length comparison to zero
--> goldboot/src/cli/cmd/init.rs:144:40
|
144 | .filter(|mold| foundry.alloy.len() == 0 || mold.alloy())
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using is_empty is clearer and more explicit: foundry.alloy.is_empty()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
goldboot/src/cli/cmd/init.rs|161 col 47| warning: Box::new(_) of default value
--> goldboot/src/cli/cmd/init.rs:161:47
|
161 | mold.prompt(&foundry, Box::new(ColorfulTheme::default()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: Box::<ColorfulTheme>::default()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#box_default
= note: #[warn(clippy::box_default)] on by default
goldboot/src/cli/progress.rs|53 col 5| warning: methods called new usually return Self
--> goldboot/src/cli/progress.rs:53:5
|
53 | / pub fn new(&self, len: u64) -> Box<dyn Fn(u64)> {
54 | | if !show_progress() {
55 | | // No progress bar
56 | | return Box::new(|
| {});
... |
66 | | })
67 | | }
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_ret_no_self
= note: #[warn(clippy::new_ret_no_self)] on by default
goldboot/src/cli/progress.rs|100 col 9| warning: this loop could be written as a while let loop
--> goldboot/src/cli/progress.rs:100:9
|
100 | / loop {
101 | | if let Ok(size) = reader.read(&mut buffer) {
102 | | if size == 0 {
103 | | break;
... |
111 | | }
112 | | }
| |
^ help: try: while let Ok(size) = reader.read(&mut buffer) { .. }
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop
= note: #[warn(clippy::while_let_loop)] on by default
goldboot/src/cli/progress.rs|105 col 17| error: written amount is not handled
--> goldboot/src/cli/progress.rs:105:17
|
105 | writer.write(&buffer[0..size])?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use Write::write_all instead, or handle partial writes
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
= note: #[deny(clippy::unused_io_amount)] on by default
goldboot/src/cli/progress.rs|119 col 40| warning: this boolean expression can be simplified
--> goldboot/src/cli/progress.rs:119:40
|
119 | std::io::stdout().is_terminal() && !std::env::var("CI").is_ok()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: std::env::var("CI").is_err()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
= note: #[warn(clippy::nonminimal_bool)] on by default
goldboot/src/foundry/fabricators/ansible.rs|29 col 18| warning: single argument that looks like it should be multiple arguments
--> goldboot/src/foundry/fabricators/ansible.rs:29:18
|
29 | .arg("-o StrictHostKeyChecking=no")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_command_arg_space
= note: #[warn(clippy::suspicious_command_arg_space)] on by default
help: consider splitting the argument
|
29 | .args(["-o", "StrictHostKeyChecking=no"])
| ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
goldboot/src/foundry/http.rs|20 col 5| warning: methods called new usually return Self
--> goldboot/src/foundry/http.rs:20:5
|
20 | / pub fn new() -> Result {
21 | | Ok(HttpServerBuilder {
22 | | router: Router::new(),
23 | | directory: tempfile::tempdir()?,
24 | | })
25 | | }
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_ret_no_self
goldboot/src/foundry/http.rs|42 col 59| warning: single-character string constant used as pattern
--> goldboot/src/foundry/http.rs:42:59
|
42 | let path = format!("/{}", path.trim_start_matches("/"));
| ^^^ help: consider using a char: '/'
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
= note: #[warn(clippy::single_char_pattern)] on by default
goldboot/src/foundry/molds/arch_linux/archinstall.rs|241 col 18| warning: use of unwrap_or to construct default value
--> goldboot/src/foundry/molds/arch_linux/archinstall.rs:241:18
|
241 | .unwrap_or(Hostname::default())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: unwrap_or_default()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: #[warn(clippy::unwrap_or_default)] on by default
goldboot/src/foundry/molds/arch_linux/mod.rs|70 col 41| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/molds/arch_linux/mod.rs:70:41
|
70 | let mut qemu = QemuBuilder::new(&worker, OsCategory::Linux)
| ^^^^^^^ help: change this to: worker
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/molds/arch_linux/mod.rs|175 col 37| warning: useless use of format!
--> goldboot/src/foundry/molds/arch_linux/mod.rs:175:37
|
175 | let rs = reqwest::blocking::get(format!(
| _____________________________________^
176 | | "http://mirror.fossable.org/archlinux/iso/latest/sha256sums.txt"
177 | | ))?;
| |
^ help: consider using .to_string(): "http://mirror.fossable.org/archlinux/iso/latest/sha256sums.txt".to_string()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: #[warn(clippy::useless_format)] on by default
goldboot/src/foundry/molds/arch_linux/mod.rs|179 col 48| warning: filter_map() will run forever if the iterator repeatedly produces an Err
--> goldboot/src/foundry/molds/arch_linux/mod.rs:179:48
|
179 | for line in BufReader::new(rs).lines().filter_map(|result| result.ok()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: map_while(Result::ok)
|
note: this expression returning a std::io::Lines may produce an infinite number of Err in case of a read error
--> goldboot/src/foundry/molds/arch_linux/mod.rs:179:21
|
179 | for line in BufReader::new(rs).lines().filter_map(|result| result.ok()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
= note: #[warn(clippy::lines_filter_map_ok)] on by default
goldboot/src/foundry/molds/debian/mod.rs|50 col 48| warning: filter_map() will run forever if the iterator repeatedly produces an Err
--> goldboot/src/foundry/molds/debian/mod.rs:50:48
|
50 | for line in BufReader::new(rs).lines().filter_map(|result| result.ok()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: map_while(Result::ok)
|
note: this expression returning a std::io::Lines may produce an infinite number of Err in case of a read error
--> goldboot/src/foundry/molds/debian/mod.rs:50:21
|
50 | for line in BufReader::new(rs).lines().filter_map(|result| result.ok()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
goldboot/src/foundry/molds/debian/mod.rs|101 col 41| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/molds/debian/mod.rs:101:41
|
101 | let mut qemu = QemuBuilder::new(&worker, OsCategory::Linux)
| ^^^^^^^ help: change this to: worker
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/qemu.rs|93 col 9| warning: question mark operator is useless here
--> goldboot/src/foundry/qemu.rs:93:9
|
93 | / Ok(SshConnection::new(
94 | | username,
95 | | &self.private_key,
96 | | self.ssh_port,
97 | | )?)
| |___________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
= note: #[warn(clippy::needless_question_mark)] on by default
help: try removing question mark and Ok()
|
93 ~ SshConnection::new(
94 + username,
95 + &self.private_key,
96 + self.ssh_port,
97 + )
|
goldboot/src/foundry/qemu.rs|130 col 1| warning: an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true
--> goldboot/src/foundry/qemu.rs:130:1
|
130 | impl Into<Vec> for QemuArgs {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: impl From<Local> for Foreign is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
= note: #[warn(clippy::from_over_into)] on by default
help: replace the Into implementation with From<foundry::qemu::QemuArgs>
|
130 ~ impl From for Vec {
131 ~ fn from(val: QemuArgs) -> Self {
132 | let mut cmdline = vec![
133 | String::from("-name"),
134 ~ val.name.clone(),
135 | String::from("-bios"),
136 ~ val.bios.clone(),
137 | String::from("-m"),
138 ~ val.memory.clone(),
139 | String::from("-boot"),
140 ~ val.boot.clone(),
141 | String::from("-display"),
142 ~ val.display.clone(),
143 | String::from("-smp"),
144 ~ val.smp.clone(),
145 | String::from("-machine"),
146 ~ val.machine.clone(),
147 | String::from("-rtc"),
...
150 |
151 ~ if let Some(cpu) = &val.cpu {
152 | cmdline.push(String::from("-cpu"));
...
155 |
156 ~ if let Some(smbios) = &val.smbios {
157 | cmdline.push(String::from("-smbios"));
...
160 |
161 ~ for usbdevice in &val.usbdevice {
162 | cmdline.push(String::from("-usbdevice"));
...
165 |
166 ~ for global in &val.global {
167 | cmdline.push(String::from("-global"));
...
170 |
171 ~ for drive in &val.drive {
172 | cmdline.push(String::from("-drive"));
...
175 |
176 ~ for netdev in &val.netdev {
177 | cmdline.push(String::from("-netdev"));
...
180 |
181 ~ for vnc in &val.vnc {
182 | cmdline.push(String::from("-vnc"));
...
185 |
186 ~ for device in &val.device {
187 | cmdline.push(String::from("-device"));
...
191 | cmdline.push(String::from("-vga"));
192 ~ cmdline.push(val.vga.to_string());
|
goldboot/src/foundry/qemu.rs|315 col 18| warning: file opened with create, but truncate behavior not defined
--> goldboot/src/foundry/qemu.rs:315:18
|
315 | .create(true)
| ^^^^^^^^^^^^- help: add: .truncate(true)
|
= help: if you intend to overwrite an existing file entirely, call .truncate(true)
= help: if you instead know that you may want to keep some parts of the old file, call .truncate(false)
= help: alternatively, use .append(true) to append to the file instead of overwriting it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
= note: #[warn(clippy::suspicious_open_options)] on by default
goldboot/src/foundry/qemu.rs|328 col 18| warning: file opened with create, but truncate behavior not defined
--> goldboot/src/foundry/qemu.rs:328:18
|
328 | .create(true)
| ^^^^^^^^^^^^- help: add: .truncate(true)
|
= help: if you intend to overwrite an existing file entirely, call .truncate(true)
= help: if you instead know that you may want to keep some parts of the old file, call .truncate(false)
= help: alternatively, use .append(true) to append to the file instead of overwriting it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
goldboot/src/foundry/qemu.rs|355 col 9| warning: question mark operator is useless here
--> goldboot/src/foundry/qemu.rs:355:9
|
355 | / Ok(self.drive_files(HashMap::from([
356 | | ("sshdog".to_string(), sshdog),
357 | | ("host_key".to_string(), host_key),
358 | | ("public_key".to_string(), public_key),
359 | | ]))?)
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
help: try removing question mark and Ok()
|
355 ~ self.drive_files(HashMap::from([
356 + ("sshdog".to_string(), sshdog),
357 + ("host_key".to_string(), host_key),
358 + ("public_key".to_string(), public_key),
359 + ]))
|
goldboot/src/foundry/sources/mod.rs|42 col 5| warning: method default can be confused for the standard trait method std::default::Default::default
--> goldboot/src/foundry/sources/mod.rs:42:5
|
42 | / pub fn default() -> Result {
43 | | let directory = if cfg!(target_os = "linux") {
44 | | PathBuf::from(format!(
45 | | "/home/{}/.cache/goldboot/sources",
... |
64 | | Ok(Self { directory })
65 | | }
| |_____^
|
= help: consider implementing the trait std::default::Default or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
= note: #[warn(clippy::should_implement_trait)] on by default
goldboot/src/foundry/sources/mod.rs|74 col 20| warning: this boolean expression can be simplified
--> goldboot/src/foundry/sources/mod.rs:74:20
|
74 | if !Self::verify_checksum(path.to_string_lossy().to_string(), checksum.as_str())
| ____________________^
75 | | .is_ok()
| |
_____^ help: try: Self::verify_checksum(path.to_string_lossy().to_string(), checksum.as_str()).is_err()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
goldboot/src/foundry/sources/mod.rs|117 col 43| warning: single-character string constant used as pattern
--> goldboot/src/foundry/sources/mod.rs:117:43
|
117 | let c: Vec<&str> = checksum.split(":").collect();
| ^^^ help: consider using a char: ':'
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
goldboot/src/foundry/ssh.rs|34 col 9| warning: the borrowed expression implements the required traits
--> goldboot/src/foundry/ssh.rs:34:9
|
34 | &key_path.with_extension("pub"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: key_path.with_extension("pub")
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: #[warn(clippy::needless_borrows_for_generic_args)] on by default
goldboot/src/foundry/ssh.rs|60 col 12| warning: this creates an owned instance just for comparison
--> goldboot/src/foundry/ssh.rs:60:12
|
60 | if entry.path()?.to_string_lossy().to_string() == "sshdog" {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: entry.path()?.to_string_lossy()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
= note: #[warn(clippy::cmp_owned)] on by default
goldboot/src/foundry/ssh.rs|105 col 45| warning: writing &PathBuf instead of &Path involves a new object where a slice will do
--> goldboot/src/foundry/ssh.rs:105:45
|
105 | fn connect(username: &str, private_key: &PathBuf, port: u16) -> Result {
| ^^^^^^^^ help: change this to: &Path
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: #[warn(clippy::ptr_arg)] on by default
goldboot/src/foundry/ssh.rs|162 col 28| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/ssh.rs:162:28
|
162 | channel.setenv(&var, &val)?;
| ^^^^ help: change this to: var
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/ssh.rs|162 col 34| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/ssh.rs:162:34
|
162 | channel.setenv(&var, &val)?;
| ^^^^ help: change this to: val
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/ssh.rs|177 col 47| warning: single-character string constant used as pattern
--> goldboot/src/foundry/ssh.rs:177:47
|
177 | .or(line.strip_suffix("\n"))
| ^^^^ help: consider using a char: '\n'
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
goldboot/src/foundry/vnc.rs|29 col 13| warning: ref on an entire let pattern is discouraged, take a reference with & instead
--> goldboot/src/foundry/vnc.rs:29:13
|
29 | let ref mut w = BufWriter::new(File::create(output_path)?);
| ----^^^^^^^^^---------------------------------------------- help: try: let w = &mut BufWriter::new(File::create(output_path)?);
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg
= note: #[warn(clippy::toplevel_ref_arg)] on by default
goldboot/src/foundry/vnc.rs|165 col 13| warning: you seem to be trying to use match for destructuring a single pattern. Consider using if let
--> goldboot/src/foundry/vnc.rs:165:13
|
165 | / match event {
166 | | Event::Resize(width, height) => {
167 | | self.width = width;
168 | | self.height = height;
169 | | }
170 | | _ => {}
171 | | }
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: #[warn(clippy::single_match)] on by default
help: try
|
165 ~ if let Event::Resize(width, height) = event {
166 + self.width = width;
167 + self.height = height;
168 + }
|
goldboot/src/foundry/vnc.rs|240 col 42| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/vnc.rs:240:42
|
240 | screenshot.write_png(&Path::new(&format!("screenshots/{hash}.png")))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: Path::new(&format!("screenshots/{hash}.png"))
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/vnc.rs|326 col 58| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/vnc.rs:326:58
|
326 | ... screenshot.write_png(&Path::new("screenshots/frozen.png"))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: Path::new("screenshots/frozen.png")
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/vnc.rs|380 col 36| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/vnc.rs:380:36
|
380 | .write_png(&Path::new(&format!("screenshots/{cmd_number}.png")))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: Path::new(&format!("screenshots/{cmd_number}.png"))
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/foundry/mod.rs|262 col 32| warning: this expression creates a reference which is immediately dereferenced by the compiler
--> goldboot/src/foundry/mod.rs:262:32
|
262 | self.element.mold.cast(&self)?;
| ^^^^^ help: change this to: self
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
goldboot/src/library.rs|28 col 54| warning: this if has identical blocks
--> goldboot/src/library.rs:28:54
|
28 | let directory = if cfg!(target_os = "linux") {
| _________________________^
29 | | PathBuf::from("/var/lib/goldboot/images")
30 | | } else if cfg!(target_os = "macos") {
| |
^
|
note: same as this
--> goldboot/src/library.rs:30:45
|
30 | } else if cfg!(target_os = "macos") {
| ^
31 | | PathBuf::from("/var/lib/goldboot/images")
32 | | } else {
| |
^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
= note: #[warn(clippy::if_same_then_else)] on by default
goldboot/src/library.rs|104 col 45| warning: the borrowed expression implements the required traits
--> goldboot/src/library.rs:104:45
|
104 | let mut rs = reqwest::blocking::get(&url)?;
| ^^^^ help: change this to: url
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
goldboot/src/library.rs|122 col 9| warning: question mark operator is useless here
--> goldboot/src/library.rs:122:9
|
122 | / Ok(Self::load()?
123 | | .into_iter()
124 | | .find(|image| image.id == image_id || image.id[0..12] == image_id[0..12])
125 | | .ok_or_else(|| anyhow!("Image not found"))?)
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
help: try removing question mark and Ok()
|
122 ~ Self::load()?
123 + .into_iter()
124 + .find(|image| image.id == image_id || image.id[0..12] == image_id[0..12])
125 + .ok_or_else(|| anyhow!("Image not found"))
|
goldboot/src/registry/media.rs|19 col 9| warning: unneeded return statement
--> goldboot/src/registry/media.rs:19:9
|
19 | return Ok(rs);
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: #[warn(clippy::needless_return)] on by default
help: remove return
|
19 - return Ok(rs);
19 + Ok(rs)
|
goldboot/src/registry/media.rs|15 col 13| warning: to_string applied to a type that implements Display in format! args
--> goldboot/src/registry/media.rs:15:13
|
15 | arch.to_string()
| ^^^^^^^^^^^^ help: remove this
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
= note: #[warn(clippy::to_string_in_format_args)] on by default