Skip to content

Commit 5dac50c

Browse files
committed
Resolve unnecessary_map_or clippy lint
warning: this `map_or` is redundant --> diagram/src/main.rs:16:25 | 16 | *pixel = if char::from_u32(row * width + col).map_or(false, f) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `char::from_u32(row * width + col).is_some_and(f)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `-W clippy::unnecessary-map-or` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_map_or)]`
1 parent 5f17dcb commit 5dac50c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diagram/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() {
1313
for (name, f) in diagrams {
1414
let mut imgbuf = ImageBuffer::new(width, height);
1515
for (col, row, pixel) in imgbuf.enumerate_pixels_mut() {
16-
*pixel = if char::from_u32(row * width + col).map_or(false, f) {
16+
*pixel = if char::from_u32(row * width + col).is_some_and(f) {
1717
Rgb([0u8, 0, 0])
1818
} else {
1919
Rgb([255, 255, 255])

0 commit comments

Comments
 (0)