appease the clippy

This commit is contained in:
Dustin Carlino 2019-01-24 16:16:02 -08:00
parent 590ab4bccb
commit 237a19b6ec
5 changed files with 25 additions and 24 deletions

View File

@ -57,7 +57,7 @@ impl DebugPolygon {
.polygon
.triangles()
.into_iter()
.map(|tri| Item::Triangle(tri))
.map(Item::Triangle)
.collect(),
current: 0,
});

View File

@ -57,7 +57,7 @@ impl Event {
}
glutin::WindowEvent::MouseWheel { delta, .. } => match delta {
glutin::MouseScrollDelta::LineDelta(_, dy) => {
Some(Event::MouseWheelScroll(dy as f64))
Some(Event::MouseWheelScroll(f64::from(dy)))
}
_ => None,
},

View File

@ -288,7 +288,7 @@ pub fn run<T, G: GUI<T>>(mut gui: G, window_title: &str) {
let vmetrics = fonts[0].v_metrics(Scale::uniform(text::FONT_SIZE));
// TODO This works for this font, but could be more paranoid with abs()
gui.get_mut_canvas().line_height =
(vmetrics.ascent - vmetrics.descent + vmetrics.line_gap) as f64;
f64::from(vmetrics.ascent - vmetrics.descent + vmetrics.line_gap);
gui.get_mut_canvas().glyphs = RefCell::new(Some(GlyphBrush::new(&display, fonts)));
let mut state = State {

View File

@ -120,26 +120,27 @@ impl Text {
glyphs: &mut GlyphBrush<'static, 'static>,
canvas: &Canvas,
) -> (f64, f64) {
let width = self
.lines
.iter()
.map(|(_, l)| {
let full_line = l.iter().fold(String::new(), |mut so_far, span| {
so_far.push_str(&span.text);
so_far
});
// Empty lines or whitespace-only lines effectively have 0 width.
glyphs
.pixel_bounds(Section {
text: &full_line,
scale: Scale::uniform(FONT_SIZE),
..Section::default()
})
.map(|rect| rect.width())
.unwrap_or(0)
})
.max()
.unwrap() as f64;
let width = f64::from(
self.lines
.iter()
.map(|(_, l)| {
let full_line = l.iter().fold(String::new(), |mut so_far, span| {
so_far.push_str(&span.text);
so_far
});
// Empty lines or whitespace-only lines effectively have 0 width.
glyphs
.pixel_bounds(Section {
text: &full_line,
scale: Scale::uniform(FONT_SIZE),
..Section::default()
})
.map(|rect| rect.width())
.unwrap_or(0)
})
.max()
.unwrap(),
);
// Always use the max height, since other stuff like menus assume a fixed height.
(width, (self.lines.len() as f64) * canvas.line_height)

View File

@ -371,7 +371,7 @@ impl Model {
}
map.buildings.push(raw_data::Building {
// TODO Duplicate points :(
points: b.polygon().points().into_iter().map(pt).collect(),
points: b.polygon().points().iter().map(|p| pt(*p)).collect(),
osm_tags,
osm_way_id: idx as i64,
});