Skip to content

Commit

Permalink
fix bare trait object warnings on rust-nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
lucanLepus committed Jun 9, 2019
1 parent 55c3812 commit 759bb3f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/blit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fn main() {

let mut direct: OffscreenConsole = OffscreenConsole::new(20, 20);
let mut boxed_direct: Box<OffscreenConsole> = Box::new(OffscreenConsole::new(20, 20));
let mut trait_object: &Console = &OffscreenConsole::new(20, 20);
let mut boxed_trait: Box<Console> = Box::new(OffscreenConsole::new(20, 20));
let mut trait_object: &dyn Console = &OffscreenConsole::new(20, 20);
let mut boxed_trait: Box<dyn Console> = Box::new(OffscreenConsole::new(20, 20));


root.set_default_background(colors::DARKEST_GREEN);
Expand Down
8 changes: 4 additions & 4 deletions examples/samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl ColorsSample {

}

fn set_colors(&self, console: &mut Console) {
fn set_colors(&self, console: &mut dyn Console) {
enum Dir {
TopLeft = 0,
TopRight,
Expand Down Expand Up @@ -121,7 +121,7 @@ impl ColorsSample {
}
}

fn print_random_chars(&mut self, console: &mut Console) -> colors::Color {
fn print_random_chars(&mut self, console: &mut dyn Console) -> colors::Color {
// ==== print the text with a random color ====
// get the background color at the text position
let mut text_color = console.get_char_background(SAMPLE_SCREEN_WIDTH/2, 5);
Expand Down Expand Up @@ -1519,11 +1519,11 @@ impl Render for NameSample {

struct MenuItem<'a> {
name: String,
render: &'a mut Render
render: &'a mut dyn Render
}

impl<'a> MenuItem<'a> {
fn new(name: &str, render: &'a mut Render) -> Self {
fn new(name: &str, render: &'a mut dyn Render) -> Self {
MenuItem { name: name.to_owned(), render: render }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<'a> Bsp<'a> {
pub fn traverse<F>(&self, order: TraverseOrder, mut callback: F) -> bool
where F: FnMut(&mut Bsp) -> bool
{
let cb: &mut FnMut(&mut Bsp) -> bool = &mut callback;
let cb: &mut dyn FnMut(&mut Bsp) -> bool = &mut callback;
let retval = unsafe {
let bsp = mem::transmute(self.bsp as *const ffi::TCOD_bsp_t);
match order {
Expand Down
4 changes: 2 additions & 2 deletions src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ impl Root {
pub struct RootInitializer<'a> {
width: i32,
height: i32,
title: Box<AsRef<str> + 'a>,
title: Box<dyn AsRef<str> + 'a>,
is_fullscreen: bool,
font_path: Box<AsRef<Path> + 'a>,
font_path: Box<dyn AsRef<Path> + 'a>,
font_layout: FontLayout,
font_type: FontType,
font_dimensions: (i32, i32),
Expand Down
2 changes: 1 addition & 1 deletion src/pathfinding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use map::Map;

enum PathInnerData<'a> {
Map(Map),
Callback(Box<FnMut((i32, i32), (i32, i32)) -> f32+'a>),
Callback(Box<dyn FnMut((i32, i32), (i32, i32)) -> f32+'a>),
}

pub struct AStar<'a>{
Expand Down

0 comments on commit 759bb3f

Please sign in to comment.