Skip to content

Autodiff Memory Management: BFS #4012

Autodiff Memory Management: BFS

Autodiff Memory Management: BFS #4012

GitHub Actions / clippy failed Apr 30, 2024 in 0s

reviewdog [clippy] report

reported by reviewdog 🐶

Findings (1)

crates/burn-autodiff/src/runtime/memory_management.rs|129 col 24| error: this else { if .. } block can be collapsed
--> crates/burn-autodiff/src/runtime/memory_management.rs:129:24
|
129 | } else {
| _______^
130 | | if let Some(caller_id) = caller_id {
131 | | let caller_status = self
132 | | .statuses
... |
138 | | }
139 | | }
| |
^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
= note: -D clippy::collapsible-else-if implied by -D warnings
= help: to override -D warnings add #[allow(clippy::collapsible_else_if)]
help: collapse nested if block
|
129 ~ } else if let Some(caller_id) = caller_id {
130 + let caller_status = self
131 + .statuses
132 + .get(&caller_id)
133 + .expect("Caller should have status");
134 + if let NodeMemoryStatus::Useful = caller_status {
135 + self.statuses.insert(node_id, NodeMemoryStatus::Useful);
136 + }
137 + }
|

Filtered Findings (0)

Annotations

Check failure on line 129 in crates/burn-autodiff/src/runtime/memory_management.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] crates/burn-autodiff/src/runtime/memory_management.rs#L129

error: this `else { if .. }` block can be collapsed
   --> crates/burn-autodiff/src/runtime/memory_management.rs:129:24
    |
129 |                   } else {
    |  ________________________^
130 | |                     if let Some(caller_id) = caller_id {
131 | |                         let caller_status = self
132 | |                             .statuses
...   |
138 | |                     }
139 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
    = note: `-D clippy::collapsible-else-if` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::collapsible_else_if)]`
help: collapse nested if block
    |
129 ~                 } else if let Some(caller_id) = caller_id {
130 +                     let caller_status = self
131 +                         .statuses
132 +                         .get(&caller_id)
133 +                         .expect("Caller should have status");
134 +                     if let NodeMemoryStatus::Useful = caller_status {
135 +                         self.statuses.insert(node_id, NodeMemoryStatus::Useful);
136 +                     }
137 +                 }
    |
Raw output
crates/burn-autodiff/src/runtime/memory_management.rs:129:24:e:error: this `else { if .. }` block can be collapsed
   --> crates/burn-autodiff/src/runtime/memory_management.rs:129:24
    |
129 |                   } else {
    |  ________________________^
130 | |                     if let Some(caller_id) = caller_id {
131 | |                         let caller_status = self
132 | |                             .statuses
...   |
138 | |                     }
139 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
    = note: `-D clippy::collapsible-else-if` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::collapsible_else_if)]`
help: collapse nested if block
    |
129 ~                 } else if let Some(caller_id) = caller_id {
130 +                     let caller_status = self
131 +                         .statuses
132 +                         .get(&caller_id)
133 +                         .expect("Caller should have status");
134 +                     if let NodeMemoryStatus::Useful = caller_status {
135 +                         self.statuses.insert(node_id, NodeMemoryStatus::Useful);
136 +                     }
137 +                 }
    |


__END__