Skip to content

Instantly share code, notes, and snippets.

@Xuanwo
Created February 21, 2024 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xuanwo/07858111c747f1550e229339d71716fe to your computer and use it in GitHub Desktop.
Save Xuanwo/07858111c747f1550e229339d71716fe to your computer and use it in GitHub Desktop.
error: taken reference of right operand
--> src/actions.rs:66:53
|
66 | prev_pushed_box_position = Some(player_position + &action.direction().into());
| ^^^^^^^^^^^^^^^^^^--------------------------
| |
| help: use the right value directly: `action.direction().into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
= note: `-D clippy::op-ref` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::op_ref)]`
error: taken reference of right operand
--> src/deadlock.rs:31:13
|
31 | box_position + &direction[0].into(),
| ^^^^^^^^^^^^^^^--------------------
| |
| help: use the right value directly: `direction[0].into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/deadlock.rs:32:13
|
32 | box_position + &direction[1].into(),
| ^^^^^^^^^^^^^^^--------------------
| |
| help: use the right value directly: `direction[1].into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/deadlock.rs:74:28
|
74 | let neighbor = position + &direction.into();
| ^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/deadlock.rs:123:21
|
123 | position + &directions[0].into(),
| ^^^^^^^^^^^---------------------
| |
| help: use the right value directly: `directions[0].into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/deadlock.rs:124:21
|
124 | position + &directions[1].into(),
| ^^^^^^^^^^^---------------------
| |
| help: use the right value directly: `directions[1].into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/deadlock.rs:137:41
|
137 | let mut next_position = position - &(directions[0]).into();
| ^^^^^^^^^^^-----------------------
| |
| help: use the right value directly: `(directions[0]).into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/deadlock.rs:138:27
|
138 | while map[next_position + &directions[1].into()].intersects(Tiles::Wall) {
| ^^^^^^^^^^^^^^^^---------------------
| |
| help: use the right value directly: `directions[1].into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
--> src/level.rs:35:5
|
35 | / pub fn from_str(str: &str) -> Result<Self, ParseLevelError> {
36 | | let mut map_string = String::new();
37 | | let mut metadata = HashMap::<String, String>::new();
38 | | let mut comments = String::new();
... |
119 | | })
120 | | }
| |_____^
|
= help: consider implementing the trait `std::str::FromStr` 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: `-D clippy::should-implement-trait` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::should_implement_trait)]`
error: this returns a `Result<_, ()>`
--> src/level.rs:148:5
|
148 | pub fn do_moves<I: IntoIterator<Item = Direction>>(&mut self, directions: I) -> Result<(), ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use a custom `Error` type instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
= note: `-D clippy::result-unit-err` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::result_unit_err)]`
error: this returns a `Result<_, ()>`
--> src/level.rs:156:5
|
156 | pub fn do_move(&mut self, direction: Direction) -> Result<(), ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use a custom `Error` type instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
error: taken reference of right operand
--> src/level.rs:161:35
|
161 | let new_player_position = self.player_position() + &direction.into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/level.rs:166:36
|
166 | let new_box_position = new_player_position + &direction.into();
| ^^^^^^^^^^^^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: this returns a `Result<_, ()>`
--> src/level.rs:181:5
|
181 | pub fn undo_move(&mut self) -> Result<(), ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use a custom `Error` type instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
error: taken reference of right operand
--> src/level.rs:184:36
|
184 | let box_position = self.player_position() + &last_action.direction().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------
| |
| help: use the right value directly: `last_action.direction().into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/level.rs:188:40
|
188 | let prev_player_position = self.player_position() - &last_action.direction().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------
| |
| help: use the right value directly: `last_action.direction().into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: this returns a `Result<_, ()>`
--> src/level.rs:198:5
|
198 | pub fn redo_move(&mut self) -> Result<(), ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use a custom `Error` type instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/level.rs:217:24
|
217 | Self::from_str(&group)
| ^^^^^^ help: change this to: `group`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `-D clippy::needless-borrow` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/level.rs:222:57
|
222 | Self::to_groups(str).map(|group| Self::from_str(&group))
| ^^^^^^ help: change this to: `group`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
error: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
--> src/map.rs:40:5
|
40 | / pub fn from_str(str: &str) -> Result<Self, ParseMapError> {
41 | | debug_assert!(!str.trim().is_empty(), "string is empty");
42 | |
43 | | // Calculate map dimensions and indentation
... |
121 | | Ok(instance)
122 | | }
| |_____^
|
= help: consider implementing the trait `std::str::FromStr` 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
error: taken reference of right operand
--> src/map.rs:171:44
|
171 | final_box_positions.insert(final_player_position + &action.direction().into());
| ^^^^^^^^^^^^^^^^^^^^^^^^--------------------------
| |
| help: use the right value directly: `action.direction().into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/map.rs:600:32
|
600 | let neighbor = position + &direction.into();
| ^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:56:32
|
56 | let new_position = node.position + &direction.into();
| ^^^^^^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:139:45
|
139 | if !player_reachable_area.contains(&(initial_box_position - &direction.into())) {
| ^^^^^^^^^^^^^^^^^^^^^^^^-----------------^
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:147:31
|
147 | let player_position = box_position - &push_direction.into();
| ^^^^^^^^^^^^^^^----------------------
| |
| help: use the right value directly: `push_direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:154:36
|
154 | let new_box_position = box_position + &push_direction.into();
| ^^^^^^^^^^^^^^^----------------------
| |
| help: use the right value directly: `push_direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:158:39
|
158 | let new_player_position = box_position - &push_direction.into();
| ^^^^^^^^^^^^^^^----------------------
| |
| help: use the right value directly: `push_direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:196:28
|
196 | let neighbor = current - &(*push_direction).into();
| ^^^^^^^^^^-------------------------
| |
| help: use the right value directly: `(*push_direction).into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:226:35
|
226 | let player_position = box_position - &direction.into();
| ^^^^^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:227:36
|
227 | let new_box_position = box_position + &direction.into();
| ^^^^^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: taken reference of right operand
--> src/path_finding.rs:255:28
|
255 | let neighbor = position + &direction.into();
| ^^^^^^^^^^^-----------------
| |
| help: use the right value directly: `direction.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
error: this loop could be written as a `for` loop
--> src/run_length.rs:60:13
|
60 | while let Some(char) = iter.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for char in iter.by_ref()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
= note: `-D clippy::while-let-on-iterator` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::while_let_on_iterator)]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment