Skip to content

Commit

Permalink
clippy:if_not_else
Browse files Browse the repository at this point in the history
warning: unnecessary `!=` operation
--> src/xls.rs:1323:5
|
1323 | / if stack.len() != 1 {
1324 | | Err(XlsError::InvalidFormula {
1325 | | stack_size: stack.len(),
1326 | | })
1327 | | } else {
1328 | | Ok(formula)
1329 | | }
| |_____^
|
= help: change to `==` and swap the blocks of the `if`/`else`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
= note: `-W clippy::if-not-else` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::if_not_else)]`

warning: unnecessary `!=` operation
    --> src/xlsb.rs:1082:5
     |
1082 | /     if stack.len() != 1 {
1083 | |         Err(XlsbError::StackLen)
1084 | |     } else {
1085 | |         Ok(formula)
1086 | |     }
     | |_____^
     |
     = help: change to `==` and swap the blocks of the `if`/`else`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else

warning: unnecessary boolean `not` operation
   --> src/de.rs:395:9
    |
395 | /         if !self.has_headers() {
396 | |             visitor.visit_seq(self)
397 | |         } else {
398 | |             visitor.visit_map(self)
399 | |         }
    | |_________^
    |
    = help: remove the `!` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else

warning: unnecessary boolean `not` operation
   --> src/de.rs:408:9
    |
408 | /         if !self.has_headers() {
409 | |             visitor.visit_seq(self)
410 | |         } else {
411 | |             visitor.visit_map(self)
412 | |         }
    | |_________^
    |
    = help: remove the `!` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
  • Loading branch information
jqnatividad committed Sep 29, 2023
1 parent e810a7a commit be17df5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ where
}

fn deserialize_map<V: Visitor<'de>>(self, visitor: V) -> Result<V::Value, Self::Error> {
if !self.has_headers() {
visitor.visit_seq(self)
} else {
if self.has_headers() {
visitor.visit_map(self)
} else {
visitor.visit_seq(self)
}
}

Expand All @@ -405,10 +405,10 @@ where
_cells: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error> {
if !self.has_headers() {
visitor.visit_seq(self)
} else {
if self.has_headers() {
visitor.visit_map(self)
} else {
visitor.visit_seq(self)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/xls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,12 +1320,12 @@ fn parse_formula(
}
}
}
if stack.len() != 1 {
if stack.len() == 1 {
Ok(formula)
} else {
Err(XlsError::InvalidFormula {
stack_size: stack.len(),
})
} else {
Ok(formula)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/xlsb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,10 @@ fn parse_formula(
}
}

if stack.len() != 1 {
Err(XlsbError::StackLen)
} else {
if stack.len() == 1 {
Ok(formula)
} else {
Err(XlsbError::StackLen)
}
}

Expand Down

0 comments on commit be17df5

Please sign in to comment.