Skip to content

Commit 7b9c055

Browse files
committed
Linter issue
1 parent 6bd3004 commit 7b9c055

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

plotters-svg/src/svg.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fs::File;
1313
use std::io::Cursor;
1414
use std::io::{BufWriter, Error, Write};
1515
use std::path::Path;
16+
use std::fmt::Write as _;
1617

1718
fn make_svg_color(color: BackendColor) -> String {
1819
let (r, g, b) = color.rgb;
@@ -314,7 +315,7 @@ impl<'a> DrawingBackend for SVGBackend<'a> {
314315
(
315316
"points",
316317
&path.into_iter().fold(String::new(), |mut s, (x, y)| {
317-
s.push_str(&format!("{},{} ", x, y));
318+
write!(s, "{},{} ", x, y).ok();
318319
s
319320
}),
320321
),
@@ -340,7 +341,7 @@ impl<'a> DrawingBackend for SVGBackend<'a> {
340341
(
341342
"points",
342343
&path.into_iter().fold(String::new(), |mut s, (x, y)| {
343-
s.push_str(&format!("{},{} ", x, y));
344+
write!(s, "{},{} ", x, y).ok();
344345
s
345346
}),
346347
),

plotters/src/chart/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'a, 'b, DB: DrawingBackend> ChartBuilder<'a, 'b, DB> {
253253
size: S,
254254
) -> &mut Self {
255255
let size = size.in_pixels(self.root_area);
256-
self.label_area_size[pos as usize] = size.abs() as u32;
256+
self.label_area_size[pos as usize] = size.unsigned_abs();
257257
self.overlap_plotting_area[pos as usize] = size < 0;
258258
self
259259
}

plotters/src/chart/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT> {
6868
}
6969
}
7070

71-
impl<'a, 'b, DB, CT> From<&ChartContext<'a, DB, CT>> for ChartState<CT>
71+
impl<'a, DB, CT> From<&ChartContext<'a, DB, CT>> for ChartState<CT>
7272
where
7373
DB: DrawingBackend,
7474
CT: CoordTranslate + Clone,

plotters/src/style/font/font_desc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'a> FontDesc<'a> {
154154
pub fn box_size(&self, text: &str) -> FontResult<(u32, u32)> {
155155
let ((min_x, min_y), (max_x, max_y)) = self.layout_box(text)?;
156156
let (w, h) = self.get_transform().transform(max_x - min_x, max_y - min_y);
157-
Ok((w.abs() as u32, h.abs() as u32))
157+
Ok((w.unsigned_abs(), h.unsigned_abs()))
158158
}
159159

160160
/// Actually draws a font with a drawing function

0 commit comments

Comments
 (0)