Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler errors after clippy fixes. Maybe issue with WebAssembly attribute. #12932

Open
PaulXiCao opened this issue Jun 14, 2024 · 0 comments
Open
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@PaulXiCao
Copy link

Summary

I ran clippy on my code and it reported: "after fixes were automatically applied the compiler reported errors within these files: ...".

My code is available at: PaulXiCao/oxidized-turret@6ee2ffa.

Rust version:

$ rustc -Vv
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

Clippy output:

$ cargo clippy --fix
    Checking oxidized-turret v0.1.0 (/home/paul/info/oxidized-turret)
warning: failed to automatically apply fixes suggested by rustc to crate `oxidized_turret`

after fixes were automatically applied the compiler reported errors within these files:

  * src/lib.rs
  * src/path.rs
  * src/recycled_list.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-clippy/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: #[wasm_bindgen] trait impls are not supported
  --> src/lib.rs:63:6
   |
63 | impl Default for Game {
   |      ^^^^^^^

warning: redundant field names in struct initialization
  --> src/path.rs:23:58
   |
23 |                 successors.push(GridPosition { x: x - 1, y: y });
   |                                                          ^^^^ help: replace it with: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
   = note: `#[warn(clippy::redundant_field_names)]` on by default

warning: redundant field names in struct initialization
  --> src/path.rs:26:48
   |
26 |                 successors.push(GridPosition { x: x, y: y - 1 });
   |                                                ^^^^ help: replace it with: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/path.rs:29:58
   |
29 |                 successors.push(GridPosition { x: x + 1, y: y });
   |                                                          ^^^^ help: replace it with: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/path.rs:32:48
   |
32 |                 successors.push(GridPosition { x: x, y: y + 1 });
   |                                                ^^^^ help: replace it with: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/recycled_list.rs:99:17
   |
99 |                 item_ref: item_ref,
   |                 ^^^^^^^^^^^^^^^^^^ help: replace it with: `item_ref`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/recycled_list.rs:110:17
    |
110 |                 item_ref: item_ref,
    |                 ^^^^^^^^^^^^^^^^^^ help: replace it with: `item_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

error: aborting due to 1 previous error; 6 warnings emitted

Original diagnostics will follow.

warning: unused import: `ExternalTurret`
 --> src/lib.rs:9:71
  |
9 |     to_external_turret, to_external_turret_with_stats, ExternalState, ExternalTurret, GameResult,
  |                                                                       ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: fields `crit_chance` and `crit_multiplier` are never read
   --> src/entities.rs:214:9
    |
208 | pub struct StaticSniperData {
    |            ---------------- fields in this struct
...
214 |     pub crit_chance: f32,
    |         ^^^^^^^^^^^
215 |     pub crit_multiplier: f32,
    |         ^^^^^^^^^^^^^^^
    |
    = note: `StaticSniperData` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
    = note: `#[warn(dead_code)]` on by default

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/entities.rs:199:25
    |
199 |                 target: self.target.clone(),
    |                         ^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.target`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

warning: called `map_or(None, ..)` on an `Option` value
   --> src/entities.rs:426:12
    |
426 |       return creeps
    |  ____________^
427 | |         .enumerate()
428 | |         .map(|creep_item| (distance(creep_item.data.pos, turret_pos), creep_item))
429 | |         .filter(|(d, _item_ref)| *d < turret_range)
430 | |         .min_by_key(|(d, _item_ref)| (*d * 100.0) as i32)
431 | |         .map_or(None, |x| Some(x.1));
    | |____________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_or_none
    = note: `#[warn(clippy::option_map_or_none)]` on by default
help: consider using `map`
    |
426 ~     return creeps
427 +         .enumerate()
428 +         .map(|creep_item| (distance(creep_item.data.pos, turret_pos), creep_item))
429 +         .filter(|(d, _item_ref)| *d < turret_range)
430 ~         .min_by_key(|(d, _item_ref)| (*d * 100.0) as i32).map(|x| x.1);
    |

warning: this operation has no effect
  --> src/path.rs:23:61
   |
23 |                 successors.push(GridPosition { x: x - 1, y: y + 0 });
   |                                                             ^^^^^ help: consider reducing it to: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
   = note: `#[warn(clippy::identity_op)]` on by default

warning: this operation has no effect
  --> src/path.rs:26:51
   |
26 |                 successors.push(GridPosition { x: x + 0, y: y - 1 });
   |                                                   ^^^^^ help: consider reducing it to: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: this operation has no effect
  --> src/path.rs:29:61
   |
29 |                 successors.push(GridPosition { x: x + 1, y: y + 0 });
   |                                                             ^^^^^ help: consider reducing it to: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: this operation has no effect
  --> src/path.rs:32:51
   |
32 |                 successors.push(GridPosition { x: x + 0, y: y + 1 });
   |                                                   ^^^^^ help: consider reducing it to: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: you should consider adding a `Default` implementation for `RecycledList<T>`
  --> src/recycled_list.rs:30:5
   |
30 | /     pub fn new() -> Self {
31 | |         RecycledList {
32 | |             current_id: 0,
33 | |             items: vec![],
34 | |             free_list: vec![],
35 | |         }
36 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
   = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
   |
29 + impl<T> Default for RecycledList<T> {
30 +     fn default() -> Self {
31 +         Self::new()
32 +     }
33 + }
   |

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> src/recycled_list.rs:74:9
   |
74 | /         match item {
75 | |             Some(item) => {
76 | |                 if item.item_ref.id == item_ref.id {
77 | |                     item.item_ref.id = 0;
...  |
81 | |             _ => (),
82 | |         }
   | |_________^
   |
   = 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
   |
74 ~         if let Some(item) = item {
75 +             if item.item_ref.id == item_ref.id {
76 +                 item.item_ref.id = 0;
77 +                 self.free_list.push(item_ref.index);
78 +             }
79 +         }
   |

warning: unneeded `return` statement
  --> src/recycled_list.rs:96:13
   |
96 |             return item_ref;
   |             ^^^^^^^^^^^^^^^
   |
   = 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`
   |
96 -             return item_ref;
96 +             item_ref
   |

warning: unneeded `return` statement
   --> src/recycled_list.rs:107:13
    |
107 |             return item_ref;
    |             ^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
107 -             return item_ref;
107 +             item_ref
    |

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
  --> src/recycled_list.rs:93:27
   |
93 |                 item_ref: item_ref.clone(),
   |                           ^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `item_ref`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/recycled_list.rs:104:27
    |
104 |                 item_ref: item_ref.clone(),
    |                           ^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `item_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: call to `reserve` immediately after creation
   --> src/recycled_list.rs:119:9
    |
119 | /         let mut items_to_remove: Vec<RecycledListRef> = vec![];
120 | |         items_to_remove.reserve(self.items.len() - self.free_list.len());
    | |_________________________________________________________________________^ help: consider using `Vec::with_capacity(/* Space hint */)`: `let mut items_to_remove: Vec<RecycledListRef> = Vec::with_capacity(self.items.len() - self.free_list.len());`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#reserve_after_initialization
    = note: `#[warn(clippy::reserve_after_initialization)]` on by default

warning: using `clone` on type `GridPosition` which implements the `Copy` trait
  --> src/lib.rs:28:21
   |
28 |     let mut start = game.state.creep_spawn.clone();
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `game.state.creep_spawn`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: you should consider adding a `Default` implementation for `Game`
  --> src/lib.rs:64:5
   |
64 | /     pub fn new() -> Self {
65 | |         utils::set_panic_hook();
66 | |
67 | |         let state = State {
...  |
94 | |         game
95 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
   |
63 + impl Default for Game {
64 +     fn default() -> Self {
65 +         Self::new()
66 +     }
67 + }
   |

warning: you are using an explicit closure for copying elements
   --> src/lib.rs:123:24
    |
123 |             particles: state.particles.iter().map(|x| *x).collect(),
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `state.particles.iter().copied()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
    = note: `#[warn(clippy::map_clone)]` on by default

warning: you are using an explicit closure for copying elements
   --> src/lib.rs:124:21
    |
124 |             creeps: state.creeps.iter().map(|x| *x).collect(),
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `state.creeps.iter().copied()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/lib.rs:136:9
    |
136 | /         match self.state.game_phase {
137 | |             GamePhase::Fighting => return,
138 | |             _ => (),
139 | |         }
    | |_________^ help: try: `if let GamePhase::Fighting = self.state.game_phase { return }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match

warning: called `is_some()` after searching an `Iterator` with `find`
   --> src/lib.rs:164:14
    |
164 |               .find(|x| x.general_data.pos == grid_pos)
    |  ______________^
165 | |             .is_some()
    | |______________________^ help: consider using: `any(|x| x.general_data.pos == grid_pos)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
    = note: `#[warn(clippy::search_is_some)]` on by default

warning: manual implementation of `Option::map`
   --> src/lib.rs:205:9
    |
205 | /         match value {
206 | |             None => None,
207 | |             Some(x) => Some(TurretRef {
208 | |                 data: to_external_turret_with_stats(&x.data, &self.state),
209 | |                 turret_ref: x.item_ref.clone(),
210 | |             }),
211 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
    = note: `#[warn(clippy::manual_map)]` on by default
help: try
    |
205 ~         value.map(|x| TurretRef {
206 +                 data: to_external_turret_with_stats(&x.data, &self.state),
207 +                 turret_ref: x.item_ref.clone(),
208 +             })
    |

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/lib.rs:209:29
    |
209 |                 turret_ref: x.item_ref.clone(),
    |                             ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `x.item_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: manual implementation of `Option::map`
   --> src/lib.rs:215:9
    |
215 | /         match self.turret_state.get(turret_ref) {
216 | |             Some(turret) => Some(TurretRef {
217 | |                 data: to_external_turret_with_stats(turret, &self.state),
218 | |                 turret_ref,
219 | |             }),
220 | |             None => None,
221 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
help: try
    |
215 ~         self.turret_state.get(turret_ref).map(|turret| TurretRef {
216 +                 data: to_external_turret_with_stats(turret, &self.state),
217 +                 turret_ref,
218 +             })
    |

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/lib.rs:268:9
    |
268 | /         match self.state.game_phase {
269 | |             GamePhase::Building => {
270 | |                 self.state.game_phase = GamePhase::Fighting;
271 | |             }
272 | |             _ => (),
273 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
    |
268 ~         if let GamePhase::Building = self.state.game_phase {
269 +             self.state.game_phase = GamePhase::Fighting;
270 +         }
    |

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/lib.rs:280:9
    |
280 | /         match self.state.game_phase {
281 | |             GamePhase::Building => return,
282 | |             _ => (),
283 | |         }
    | |_________^ help: try: `if let GamePhase::Building = self.state.game_phase { return }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/lib.rs:313:39
    |
313 |                 creeps_to_remove.push(creep_item.item_ref.clone());
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `creep_item.item_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/lib.rs:332:38
    |
332 |             self.state.creeps.remove(creep_to_remove.clone());
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*creep_to_remove`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/lib.rs:372:46
    |
372 |                     self.state.creeps.remove(particle.target.clone());
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `particle.target`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/lib.rs:383:41
    |
383 |             self.state.particles.remove(particle_to_remove.clone());
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*particle_to_remove`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: `oxidized-turret` (lib) generated 30 warnings (run `cargo clippy --fix --lib -p oxidized-turret` to apply 24 suggestions)
warning: failed to automatically apply fixes suggested by rustc to crate `oxidized_turret`

after fixes were automatically applied the compiler reported errors within these files:

  * src/lib.rs
  * src/path.rs
  * src/recycled_list.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-clippy/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: #[wasm_bindgen] trait impls are not supported
  --> src/lib.rs:63:6
   |
63 | impl Default for Game {
   |      ^^^^^^^

warning: redundant field names in struct initialization
  --> src/path.rs:23:58
   |
23 |                 successors.push(GridPosition { x: x - 1, y: y });
   |                                                          ^^^^ help: replace it with: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
   = note: `#[warn(clippy::redundant_field_names)]` on by default

warning: redundant field names in struct initialization
  --> src/path.rs:26:48
   |
26 |                 successors.push(GridPosition { x: x, y: y - 1 });
   |                                                ^^^^ help: replace it with: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/path.rs:29:58
   |
29 |                 successors.push(GridPosition { x: x + 1, y: y });
   |                                                          ^^^^ help: replace it with: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/path.rs:32:48
   |
32 |                 successors.push(GridPosition { x: x, y: y + 1 });
   |                                                ^^^^ help: replace it with: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/recycled_list.rs:99:17
   |
99 |                 item_ref: item_ref,
   |                 ^^^^^^^^^^^^^^^^^^ help: replace it with: `item_ref`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/recycled_list.rs:110:17
    |
110 |                 item_ref: item_ref,
    |                 ^^^^^^^^^^^^^^^^^^ help: replace it with: `item_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

error: aborting due to 1 previous error; 6 warnings emitted

Original diagnostics will follow.

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/recycled_list.rs:149:14
    |
149 |     v.remove(ref1.clone());
    |              ^^^^^^^^^^^^ help: try removing the `clone` call: `ref1`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/recycled_list.rs:151:27
    |
151 |     assert_eq!(*v.get_mut(ref2.clone()).unwrap(), String::from("test2"));
    |                           ^^^^^^^^^^^^ help: try removing the `clone` call: `ref2`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/recycled_list.rs:156:27
    |
156 |     assert_eq!(*v.get_mut(ref2.clone()).unwrap(), String::from("test2"));
    |                           ^^^^^^^^^^^^ help: try removing the `clone` call: `ref2`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/recycled_list.rs:157:27
    |
157 |     assert_eq!(*v.get_mut(ref3.clone()).unwrap(), String::from("test3"));
    |                           ^^^^^^^^^^^^ help: try removing the `clone` call: `ref3`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `RecycledListRef` which implements the `Copy` trait
   --> src/recycled_list.rs:158:27
    |
158 |     assert_eq!(*v.get_mut(ref4.clone()).unwrap(), String::from("test4"));
    |                           ^^^^^^^^^^^^ help: try removing the `clone` call: `ref4`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: `oxidized-turret` (lib test) generated 35 warnings (30 duplicates) (run `cargo clippy --fix --lib -p oxidized-turret --tests` to apply 5 suggestions)
warning: failed to automatically apply fixes suggested by rustc to crate `oxidized_turret`

after fixes were automatically applied the compiler reported errors within these files:

  * src/lib.rs
  * src/path.rs
  * src/recycled_list.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-clippy/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: #[wasm_bindgen] trait impls are not supported
  --> src/lib.rs:63:6
   |
63 | impl Default for Game {
   |      ^^^^^^^

warning: redundant field names in struct initialization
  --> src/path.rs:23:58
   |
23 |                 successors.push(GridPosition { x: x - 1, y: y });
   |                                                          ^^^^ help: replace it with: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
   = note: `#[warn(clippy::redundant_field_names)]` on by default

warning: redundant field names in struct initialization
  --> src/path.rs:26:48
   |
26 |                 successors.push(GridPosition { x: x, y: y - 1 });
   |                                                ^^^^ help: replace it with: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/path.rs:29:58
   |
29 |                 successors.push(GridPosition { x: x + 1, y: y });
   |                                                          ^^^^ help: replace it with: `y`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/path.rs:32:48
   |
32 |                 successors.push(GridPosition { x: x, y: y + 1 });
   |                                                ^^^^ help: replace it with: `x`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/recycled_list.rs:99:17
   |
99 |                 item_ref: item_ref,
   |                 ^^^^^^^^^^^^^^^^^^ help: replace it with: `item_ref`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/recycled_list.rs:110:17
    |
110 |                 item_ref: item_ref,
    |                 ^^^^^^^^^^^^^^^^^^ help: replace it with: `item_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

error: aborting due to 1 previous error; 6 warnings emitted

Original diagnostics will follow.

warning: `oxidized-turret` (lib) generated 30 warnings (30 duplicates)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.53s

Reproducer

I tried this code:

<code>

I expected to see this happen:

Instead, this happened:

Version

No response

Additional Labels

No response

@PaulXiCao PaulXiCao added the C-bug Category: Clippy is not doing the correct thing label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

1 participant