Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cargo clippy --fix --all-targets --all-features -- -D warnings
- Checking pyo3-ffi v0.19.2
- Checking pyo3 v0.19.2
- Checking mapfile_parser v2.2.0 (/home/angie/Documents/n64decomp/mapfile_parser)
- warning: failed to automatically apply fixes suggested by rustc to crate `mapfile_parser`
- after fixes were automatically applied the compiler reported errors within these files:
- * src/rs/segment.rs
- This likely indicates a bug in either rustc or cargo itself,
- and we would appreciate a bug report! You're likely to see
- a number of compiler warnings after this message which cargo
- attempted to fix but failed. If you could open an issue at
- https://github.com/rust-lang/rust/issues
- quoting the full output of this command we'd be very appreciative!
- Note that you may be able to make some more progress in the near-term
- fixing code with the `--broken-code` flag
- The following errors were reported:
- error[E0382]: borrow of moved value: `path`
- --> src/rs/segment.rs:133:34
- |
- 119 | let mut path: PathBuf = file
- | -------- move occurs because `path` has type `std::path::PathBuf`, which does not implement the `Copy` trait
- ...
- 130 | if let std::collections::hash_map::Entry::Vacant(e) = aux_dict.entry(path) {
- | ---- value moved here
- ...
- 133 | aux_dict.get_mut(&path).unwrap().push(file);
- | ^^^^^ value borrowed here after move
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0382`.
- Original diagnostics will follow.
- warning: redundant field names in struct initialization
- --> src/rs/segment.rs:39:13
- |
- 39 | name: name,
- | ^^^^^^^^^^ help: replace it with: `name`
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
- = note: `-D clippy::redundant-field-names` implied by `-D warnings`
- warning: unneeded late initialization
- --> src/rs/file.rs:168:9
- |
- 168 | let average_size;
- | ^^^^^^^^^^^^^^^^^
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
- = note: `-D clippy::needless-late-init` implied by `-D warnings`
- help: declare `average_size` here
- |
- 169 | let average_size = if sym_count > 0 {
- | ++++++++++++++++++
- help: remove the assignments from the branches
- |
- 170 ~ self.size as f64 / sym_count as f64
- 171 | } else {
- 172 ~ self.size as f64 / 1.0
- |
- help: add a semicolon after the `if` expression
- |
- 173 | };
- | +
- warning: you should consider adding a `Default` implementation for `MapFile`
- --> src/rs/mapfile.rs:29:5
- |
- 29 | / pub fn new() -> Self {
- 30 | | MapFile {
- 31 | | segments_list: Vec::new(),
- 32 | | debugging: false,
- 33 | | }
- 34 | | }
- | |_____^
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
- = note: `-D clippy::new-without-default` implied by `-D warnings`
- help: try adding this
- |
- 27 + impl Default for MapFile {
- 28 + fn default() -> Self {
- 29 + Self::new()
- 30 + }
- 31 + }
- |
- warning: the loop variable `i` is used to index `temp_segment_list`
- --> src/rs/mapfile.rs:148:18
- |
- 148 | for i in 0..temp_segment_list.len() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
- = note: `-D clippy::needless-range-loop` implied by `-D warnings`
- help: consider using an iterator and enumerate()
- |
- 148 | for (i, <item>) in temp_segment_list.iter_mut().enumerate() {
- | ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- warning: this `if` has identical blocks
- --> src/rs/mapfile.rs:410:49
- |
- 410 | if whole_file_is_undecomped {
- | _________________________________________________^
- 411 | | total_stats.undecomped_size += sym_size;
- 412 | | folder_progress.undecomped_size += sym_size;
- 413 | | } else if func_asm_path.exists() {
- | |_____________________^
- |
- note: same as this
- --> src/rs/mapfile.rs:413:54
- |
- 413 | } else if func_asm_path.exists() {
- | ______________________________________________________^
- 414 | | total_stats.undecomped_size += sym_size;
- 415 | | folder_progress.undecomped_size += sym_size;
- 416 | | } 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
- warning: you should consider adding a `Default` implementation for `MapsComparisonInfo`
- --> src/rs/maps_comparison_info.rs:25:5
- |
- 25 | / pub fn new() -> Self {
- 26 | | MapsComparisonInfo {
- 27 | | bad_files: HashSet::new(),
- 28 | | missing_files: HashSet::new(),
- 29 | | compared_list: Vec::new(),
- 30 | | }
- 31 | | }
- | |_____^
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
- help: try adding this
- |
- 23 + impl Default for MapsComparisonInfo {
- 24 + fn default() -> Self {
- 25 + Self::new()
- 26 + }
- 27 + }
- |
- warning: you should consider adding a `Default` implementation for `ProgressStats`
- --> src/rs/progress_stats.rs:21:5
- |
- 21 | / pub fn new() -> Self {
- 22 | | Self {
- 23 | | undecomped_size: 0,
- 24 | | decomped_size: 0,
- 25 | | }
- 26 | | }
- | |_____^
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
- help: try adding this
- |
- 19 + impl Default for ProgressStats {
- 20 + fn default() -> Self {
- 21 + Self::new()
- 22 + }
- 23 + }
- |
- warning: usage of `contains_key` followed by `insert` on a `HashMap`
- --> src/rs/segment.rs:130:13
- |
- 130 | / if !aux_dict.contains_key(&path) {
- 131 | | aux_dict.insert(path, vec![file]);
- 132 | | } else {
- 133 | | aux_dict.get_mut(&path).unwrap().push(file);
- 134 | | }
- | |_____________^
- |
- = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
- = note: `-D clippy::map-entry` implied by `-D warnings`
- help: try this
- |
- 130 ~ if let std::collections::hash_map::Entry::Vacant(e) = aux_dict.entry(path) {
- 131 + e.insert(vec![file]);
- 132 + } else {
- 133 + aux_dict.get_mut(&path).unwrap().push(file);
- 134 + }
- |
- warning: `mapfile_parser` (lib) generated 8 warnings (1 duplicate) (run `cargo clippy --fix --lib -p mapfile_parser` to apply 1 suggestion)
- warning: `mapfile_parser` (lib test) generated 8 warnings (7 duplicates) (run `cargo clippy --fix --lib -p mapfile_parser --tests` to apply 1 suggestion)
- Finished dev [unoptimized + debuginfo] target(s) in 5.21s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement