Found
if/else
with the same bodies131{
132 pub fn new(width: u32, height: u32) -> Self {
133 let data = vec![Default::default(); (width * height) as usize];
134 if data == [] {135 Pixmap {136 width,137 height,138 data,139 }140 } else {141 Pixmap {142 width,143 height,144 data,145 }146 }147 }
148
149 pub fn new_with(width: u32, height: u32, data: Vec<T>) -> Self {
Description
if-else
expressions with the same if
and else
parts are probably a result
of a copy-paste. The result of the expression is independent of the condition.
Consider revisiting the else
block.
Bad practice
let foo = if important_flag {
42
} else {
42 // probably a mistake
};