From 53cdc6ff212fc7aafdc591badc589ab9220d1606 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Thu, 27 Dec 2018 21:30:30 +0700 Subject: [PATCH] Switch to Rusr 2018! Removes all those ugly 'extern crate' and 'macro_use' lines... --- Cargo.toml | 2 +- benches/bounding_box.rs | 6 +----- benches/shaded_cube.rs | 6 +----- bounding_box.rs | 2 +- lib.rs | 13 +------------ main.rs | 9 +-------- mandelwow.rs | 2 +- shaded_cube.rs | 2 +- text.rs | 4 ++-- 9 files changed, 10 insertions(+), 36 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9d5e78f..72fc70e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ name = "mandelwow" version = "0.7.0" authors = ["Bernie Innocenti "] license = "GPL-3.0+" -#edition = '2018' +edition = '2018' [profile.release] lto = true diff --git a/benches/bounding_box.rs b/benches/bounding_box.rs index be448a7..54351d9 100644 --- a/benches/bounding_box.rs +++ b/benches/bounding_box.rs @@ -1,11 +1,7 @@ #![feature(test)] - -extern crate mandelwow_lib; -extern crate glutin; -#[macro_use(uniform)] -extern crate glium; extern crate test; +use glium::uniform; use mandelwow_lib::Cube; use mandelwow_lib::bounding_box::*; diff --git a/benches/shaded_cube.rs b/benches/shaded_cube.rs index 501976b..842e290 100644 --- a/benches/shaded_cube.rs +++ b/benches/shaded_cube.rs @@ -1,11 +1,7 @@ #![feature(test)] - -extern crate mandelwow_lib; -#[macro_use(uniform)] -extern crate glium; -extern crate glutin; extern crate test; +use glium::uniform; use mandelwow_lib::shaded_cube::*; #[bench] diff --git a/bounding_box.rs b/bounding_box.rs index 5cc4b18..71cee76 100644 --- a/bounding_box.rs +++ b/bounding_box.rs @@ -1,6 +1,6 @@ use crate::cube::Cube; use glium; -use glium::{Display, Program, Surface}; +use glium::{Display, Program, Surface, implement_vertex}; use glium::index::{IndexBuffer, PrimitiveType}; pub fn solid_fill_program(display: &Display) -> Program { diff --git a/lib.rs b/lib.rs index 5366202..c923d08 100644 --- a/lib.rs +++ b/lib.rs @@ -1,14 +1,3 @@ -extern crate cgmath; -#[macro_use(uniform,implement_vertex)] -extern crate glium; -extern crate glutin; -#[cfg(feature = "image")] -extern crate image; -extern crate libxm; -#[cfg(feature = "editor")] -extern crate rust_rocket; -extern crate sdl2; - pub mod bounding_box; pub mod cube; pub mod mandelwow; @@ -24,7 +13,7 @@ pub use crate::shaded_cube::ShadedCube; #[cfg(feature = "image")] pub fn screenshot(display : &glium::Display) { - let image: glium::texture::RawImage2d = display.read_front_buffer(); + let image: glium::texture::RawImage2d<'_, u8> = display.read_front_buffer(); let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap(); let image = image::DynamicImage::ImageRgba8(image).flipv().to_rgb(); let image = image::DynamicImage::ImageRgb8(image); diff --git a/main.rs b/main.rs index 426bfb1..1ad2eea 100644 --- a/main.rs +++ b/main.rs @@ -1,15 +1,8 @@ -extern crate mandelwow_lib; - -extern crate cgmath; -#[macro_use(uniform)] -extern crate glium; -extern crate glutin; - use cgmath::conv::array4x4; use cgmath::{Euler, Matrix4, Rad, SquareMatrix, Vector3, Vector4, Zero}; use glium::glutin::VirtualKeyCode; use glium::glutin::WindowEvent::KeyboardInput; -use glium::Surface; +use glium::{Surface, uniform}; use mandelwow_lib::*; use std::f32::consts::PI; use crate::timer::Timer; diff --git a/mandelwow.rs b/mandelwow.rs index 9b236a5..1a6516c 100644 --- a/mandelwow.rs +++ b/mandelwow.rs @@ -3,7 +3,7 @@ use crate::cube::Cube; use glium; use glium::index::PrimitiveType; -use glium::{Display, Program, Surface}; +use glium::{Display, Program, Surface, implement_vertex, uniform}; use crate::support; /* diff --git a/shaded_cube.rs b/shaded_cube.rs index 9194d7c..6019a12 100644 --- a/shaded_cube.rs +++ b/shaded_cube.rs @@ -1,5 +1,5 @@ use glium; -use glium::{Display, Program, Surface}; +use glium::{Display, Program, Surface, implement_vertex}; use glium::index::{IndexBuffer, PrimitiveType}; pub fn shaded_program(display: &Display) -> Program { diff --git a/text.rs b/text.rs index 4e1fcdf..c341959 100644 --- a/text.rs +++ b/text.rs @@ -1,7 +1,7 @@ use cgmath::conv::array4x4; use cgmath::{Matrix4, Vector3}; use glium; -use glium::{Display, Program, Surface, texture}; +use glium::{Display, Program, Surface, implement_vertex, texture, uniform}; use std; fn gamma(x: T) -> f32 @@ -63,7 +63,7 @@ pub struct Text<'a> { } impl<'a> Text<'a> { - pub fn new(display: &Display, character: char) -> Text { + pub fn new(display: &Display, character: char) -> Text<'_> { let (w, h, pixels) = c64_font(); let image = glium::texture::RawImage2d { data: std::borrow::Cow::from(pixels), -- 2.25.1