Skip to content

Commit a9f85f2

Browse files
committed
Satify clippy
With the div_ceil(2) suggestion, I verified in playground that results 0-20 don't differ just in case.
1 parent e9ae246 commit a9f85f2

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/framebuffer/common.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,8 @@ impl mxcfb_rect {
267267

268268
pub fn expand(&self, margin: u32) -> mxcfb_rect {
269269
mxcfb_rect {
270-
left: if self.left > margin {
271-
self.left - margin
272-
} else {
273-
0
274-
},
275-
top: if self.top > margin {
276-
self.top - margin
277-
} else {
278-
0
279-
},
270+
left: self.left.saturating_sub(margin),
271+
top: self.top.saturating_sub(margin),
280272
width: self.width + (2 * margin),
281273
height: self.height + (2 * margin),
282274
}

src/framebuffer/draw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl framebuffer::FramebufferDraw for core::Framebuffer {
5555
v,
5656
),
5757
};
58-
let margin = (width + 1) / 2;
58+
let margin = width.div_ceil(2);
5959
graphics::stamp_along_line(stamp, start, end).expand(margin)
6060
}
6161

0 commit comments

Comments
 (0)