Silence check warnings about [lack of] use of 'dyn' for boxed trait objects.

pull/172/head
Joe Ardent 5 years ago committed by Florian Dehau
parent bd5862437d
commit 86f681a007

@ -66,7 +66,7 @@ impl<'a> Shape<'a> for Line {
self.color
}
fn points(&'a self) -> Box<Iterator<Item = (f64, f64)> + 'a> {
fn points(&'a self) -> Box<dyn Iterator<Item = (f64, f64)> + 'a> {
Box::new(self.into_iter())
}
}

@ -37,7 +37,7 @@ impl<'a> Shape<'a> for Map {
fn color(&self) -> Color {
self.color
}
fn points(&'a self) -> Box<Iterator<Item = (f64, f64)> + 'a> {
fn points(&'a self) -> Box<dyn Iterator<Item = (f64, f64)> + 'a> {
Box::new(self.into_iter())
}
}

@ -28,7 +28,7 @@ pub trait Shape<'a> {
/// Returns the color of the shape
fn color(&self) -> Color;
/// Returns an iterator over all points of the shape
fn points(&'a self) -> Box<Iterator<Item = (f64, f64)> + 'a>;
fn points(&'a self) -> Box<dyn Iterator<Item = (f64, f64)> + 'a>;
}
/// Label to draw some text on the canvas

@ -13,7 +13,7 @@ impl<'a> Shape<'a> for Points<'a> {
fn color(&self) -> Color {
self.color
}
fn points(&'a self) -> Box<Iterator<Item = (f64, f64)> + 'a> {
fn points(&'a self) -> Box<dyn Iterator<Item = (f64, f64)> + 'a> {
Box::new(self.into_iter())
}
}

@ -14,7 +14,7 @@ impl<'a> Shape<'a> for Rectangle {
self.color
}
fn points(&'a self) -> Box<Iterator<Item = (f64, f64)> + 'a> {
fn points(&'a self) -> Box<dyn Iterator<Item = (f64, f64)> + 'a> {
let left_line = Line {
x1: f64::from(self.rect.x),
y1: f64::from(self.rect.y),

@ -15,7 +15,7 @@ pub trait LineComposer<'a> {
/// A state machine that wraps lines on word boundaries.
pub struct WordWrapper<'a, 'b> {
symbols: &'b mut Iterator<Item = Styled<'a>>,
symbols: &'b mut dyn Iterator<Item = Styled<'a>>,
max_line_width: u16,
current_line: Vec<Styled<'a>>,
next_line: Vec<Styled<'a>>,
@ -23,7 +23,7 @@ pub struct WordWrapper<'a, 'b> {
impl<'a, 'b> WordWrapper<'a, 'b> {
pub fn new(
symbols: &'b mut Iterator<Item = Styled<'a>>,
symbols: &'b mut dyn Iterator<Item = Styled<'a>>,
max_line_width: u16,
) -> WordWrapper<'a, 'b> {
WordWrapper {
@ -121,14 +121,14 @@ impl<'a, 'b> LineComposer<'a> for WordWrapper<'a, 'b> {
/// A state machine that truncates overhanging lines.
pub struct LineTruncator<'a, 'b> {
symbols: &'b mut Iterator<Item = Styled<'a>>,
symbols: &'b mut dyn Iterator<Item = Styled<'a>>,
max_line_width: u16,
current_line: Vec<Styled<'a>>,
}
impl<'a, 'b> LineTruncator<'a, 'b> {
pub fn new(
symbols: &'b mut Iterator<Item = Styled<'a>>,
symbols: &'b mut dyn Iterator<Item = Styled<'a>>,
max_line_width: u16,
) -> LineTruncator<'a, 'b> {
LineTruncator {

Loading…
Cancel
Save