diff --git a/editor/src/plugins/debug/debug_polygon.rs b/editor/src/plugins/debug/debug_polygon.rs index eaae9bc7aa..53505194b3 100644 --- a/editor/src/plugins/debug/debug_polygon.rs +++ b/editor/src/plugins/debug/debug_polygon.rs @@ -57,7 +57,7 @@ impl DebugPolygon { .polygon .triangles() .into_iter() - .map(|tri| Item::Triangle(tri)) + .map(Item::Triangle) .collect(), current: 0, }); diff --git a/ezgui/src/event.rs b/ezgui/src/event.rs index 26d3ba9fad..616c2f03a0 100644 --- a/ezgui/src/event.rs +++ b/ezgui/src/event.rs @@ -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, }, diff --git a/ezgui/src/runner.rs b/ezgui/src/runner.rs index 1b97104c36..4fbe2aab82 100644 --- a/ezgui/src/runner.rs +++ b/ezgui/src/runner.rs @@ -288,7 +288,7 @@ pub fn run>(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 { diff --git a/ezgui/src/text.rs b/ezgui/src/text.rs index 0263e1aa02..7375e58f1f 100644 --- a/ezgui/src/text.rs +++ b/ezgui/src/text.rs @@ -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) diff --git a/synthetic/src/model.rs b/synthetic/src/model.rs index a7b3d9d76d..4501970fbd 100644 --- a/synthetic/src/model.rs +++ b/synthetic/src/model.rs @@ -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, });