From 90937eaa4d2e9c97cc9591543b5a652754b63da0 Mon Sep 17 00:00:00 2001 From: est31 Date: Mon, 15 Apr 2019 08:43:15 +0200 Subject: [PATCH] Silence unused imports warning in examples glium reexports glutin and I think this point needs to be stressed. So using glutin from the reexport instead of the possibly available extern crate is useful at least in the examples otherwise users might not realize that they don't have to add glutin to their Cargo.toml. Therefore, the lint is silenced instead of being followed. Link to the lint change that likely caused this: https://github.com/rust-lang/rust/pull/58805 --- examples/blitting.rs | 1 + examples/deferred.rs | 1 + examples/displacement_mapping.rs | 1 + examples/fullscreen.rs | 1 + examples/fxaa.rs | 1 + examples/gpgpu.rs | 1 + examples/image.rs | 1 + examples/info.rs | 1 + examples/instancing.rs | 1 + examples/manual-creation.rs | 1 + examples/picking.rs | 1 + examples/screenshot-asynchronous.rs | 1 + examples/screenshot.rs | 3 ++- examples/shadow_mapping.rs | 1 + examples/sprites-batching.rs | 1 + examples/subroutines.rs | 1 + examples/teapot.rs | 1 + examples/tessellation.rs | 1 + examples/triangle.rs | 1 + examples/tutorial-01.rs | 1 + examples/tutorial-02.rs | 1 + examples/tutorial-03.rs | 1 + examples/tutorial-04.rs | 1 + examples/tutorial-05.rs | 1 + examples/tutorial-06.rs | 1 + examples/tutorial-07.rs | 1 + examples/tutorial-08.rs | 1 + examples/tutorial-09.rs | 1 + examples/tutorial-10.rs | 1 + examples/tutorial-12.rs | 1 + examples/tutorial-13.rs | 1 + examples/tutorial-14.rs | 1 + 32 files changed, 33 insertions(+), 1 deletion(-) diff --git a/examples/blitting.rs b/examples/blitting.rs index 8e958aed039..383a8be69e2 100644 --- a/examples/blitting.rs +++ b/examples/blitting.rs @@ -5,6 +5,7 @@ extern crate glium; extern crate image; use std::io::Cursor; +#[allow(unused_imports)] use glium::{glutin, Surface}; mod support; diff --git a/examples/deferred.rs b/examples/deferred.rs index 1906e40b9c2..df5a2a95b62 100644 --- a/examples/deferred.rs +++ b/examples/deferred.rs @@ -4,6 +4,7 @@ extern crate cgmath; extern crate image; use glium::index::PrimitiveType; +#[allow(unused_imports)] use glium::{glutin, Surface}; use std::io::Cursor; diff --git a/examples/displacement_mapping.rs b/examples/displacement_mapping.rs index 5df5337afed..8aba74dfca4 100644 --- a/examples/displacement_mapping.rs +++ b/examples/displacement_mapping.rs @@ -3,6 +3,7 @@ extern crate image; extern crate glium; use std::io::Cursor; +#[allow(unused_imports)] use glium::{glutin, Surface}; mod support; diff --git a/examples/fullscreen.rs b/examples/fullscreen.rs index de12a53207c..ae5e2a64f77 100644 --- a/examples/fullscreen.rs +++ b/examples/fullscreen.rs @@ -7,6 +7,7 @@ use std::io::Cursor; use glium::Surface; use glium::index::PrimitiveType; +#[allow(unused_imports)] use glium::glutin::{self, ElementState, VirtualKeyCode, Event, WindowEvent}; mod support; diff --git a/examples/fxaa.rs b/examples/fxaa.rs index 47c1fae1913..242b21b44ea 100644 --- a/examples/fxaa.rs +++ b/examples/fxaa.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate glium; +#[allow(unused_imports)] use glium::{glutin, Surface}; mod support; diff --git a/examples/gpgpu.rs b/examples/gpgpu.rs index 3a770e78b67..26dc572e01d 100644 --- a/examples/gpgpu.rs +++ b/examples/gpgpu.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate glium; extern crate rand; +#[allow(unused_imports)] use glium::glutin; use glutin::dpi::PhysicalSize; diff --git a/examples/image.rs b/examples/image.rs index c1ff04221f4..31260a46691 100644 --- a/examples/image.rs +++ b/examples/image.rs @@ -4,6 +4,7 @@ extern crate image; use std::io::Cursor; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; diff --git a/examples/info.rs b/examples/info.rs index 413a5aa8b1e..494216e383e 100644 --- a/examples/info.rs +++ b/examples/info.rs @@ -1,6 +1,7 @@ extern crate glium; fn main() { + #[allow(unused_imports)] use glium::{glutin, Api, Profile, Version}; // building the display, ie. the main object diff --git a/examples/instancing.rs b/examples/instancing.rs index 0adb7a06d6a..5156ac153ea 100644 --- a/examples/instancing.rs +++ b/examples/instancing.rs @@ -2,6 +2,7 @@ extern crate glium; extern crate rand; +#[allow(unused_imports)] use glium::{glutin, Surface}; mod support; diff --git a/examples/manual-creation.rs b/examples/manual-creation.rs index 6096eca056f..cdbc39b4256 100644 --- a/examples/manual-creation.rs +++ b/examples/manual-creation.rs @@ -19,6 +19,7 @@ There are three concepts in play: extern crate glium; use glium::Surface; +#[allow(unused_imports)] use glium::glutin::{self, ContextTrait}; use std::rc::Rc; diff --git a/examples/picking.rs b/examples/picking.rs index 333a816b8ee..2951c05def7 100644 --- a/examples/picking.rs +++ b/examples/picking.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate glium; +#[allow(unused_imports)] use glium::{glutin, Surface}; mod support; diff --git a/examples/screenshot-asynchronous.rs b/examples/screenshot-asynchronous.rs index 6851dea965e..c513b491999 100644 --- a/examples/screenshot-asynchronous.rs +++ b/examples/screenshot-asynchronous.rs @@ -4,6 +4,7 @@ extern crate image; use std::thread; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; diff --git a/examples/screenshot.rs b/examples/screenshot.rs index fa22e62cc59..0e96b5cd901 100644 --- a/examples/screenshot.rs +++ b/examples/screenshot.rs @@ -2,6 +2,7 @@ extern crate glium; extern crate image; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; @@ -112,7 +113,7 @@ fn main() { target.finish().unwrap(); // reading the front buffer into an image - let image: glium::texture::RawImage2d = display.read_front_buffer(); + let image: glium::texture::RawImage2d = display.read_front_buffer().unwrap(); let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap(); let image = image::DynamicImage::ImageRgba8(image).flipv(); image.save("glium-example-screenshot.png").unwrap(); diff --git a/examples/shadow_mapping.rs b/examples/shadow_mapping.rs index 68d403fac1d..b039bad53f1 100644 --- a/examples/shadow_mapping.rs +++ b/examples/shadow_mapping.rs @@ -3,6 +3,7 @@ extern crate glium; extern crate cgmath; use cgmath::SquareMatrix; +#[allow(unused_imports)] use glium::{glutin, Surface}; use std::time::Instant; use glutin::dpi::LogicalSize; diff --git a/examples/sprites-batching.rs b/examples/sprites-batching.rs index 422d82a99a2..d70e2768426 100644 --- a/examples/sprites-batching.rs +++ b/examples/sprites-batching.rs @@ -2,6 +2,7 @@ extern crate glium; extern crate rand; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; diff --git a/examples/subroutines.rs b/examples/subroutines.rs index 4e94062c2e3..fa648fd437f 100644 --- a/examples/subroutines.rs +++ b/examples/subroutines.rs @@ -3,6 +3,7 @@ extern crate glium; mod support; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; use glium::program::ShaderStage; diff --git a/examples/teapot.rs b/examples/teapot.rs index ce2e41302c6..8c2fad72a9c 100644 --- a/examples/teapot.rs +++ b/examples/teapot.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate glium; +#[allow(unused_imports)] use glium::{glutin, Surface}; mod support; diff --git a/examples/tessellation.rs b/examples/tessellation.rs index 67332223db0..8b7dd415871 100644 --- a/examples/tessellation.rs +++ b/examples/tessellation.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate glium; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; diff --git a/examples/triangle.rs b/examples/triangle.rs index 4fae24753d8..a05acac9540 100644 --- a/examples/triangle.rs +++ b/examples/triangle.rs @@ -3,6 +3,7 @@ extern crate glium; mod support; +#[allow(unused_imports)] use glium::{glutin, Surface}; use glium::index::PrimitiveType; diff --git a/examples/tutorial-01.rs b/examples/tutorial-01.rs index 7884fc50c7f..dfd3fd45a8d 100644 --- a/examples/tutorial-01.rs +++ b/examples/tutorial-01.rs @@ -1,6 +1,7 @@ extern crate glium; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-02.rs b/examples/tutorial-02.rs index df16165981e..a288e5c9c09 100644 --- a/examples/tutorial-02.rs +++ b/examples/tutorial-02.rs @@ -2,6 +2,7 @@ extern crate glium; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-03.rs b/examples/tutorial-03.rs index 4f4407f9541..ffd168d126e 100644 --- a/examples/tutorial-03.rs +++ b/examples/tutorial-03.rs @@ -2,6 +2,7 @@ extern crate glium; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-04.rs b/examples/tutorial-04.rs index 91f39f6bed1..080b4097a5d 100644 --- a/examples/tutorial-04.rs +++ b/examples/tutorial-04.rs @@ -2,6 +2,7 @@ extern crate glium; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-05.rs b/examples/tutorial-05.rs index c821b39f316..ff3ad6590f0 100644 --- a/examples/tutorial-05.rs +++ b/examples/tutorial-05.rs @@ -2,6 +2,7 @@ extern crate glium; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-06.rs b/examples/tutorial-06.rs index 3c98ee76710..a5a52f6962b 100644 --- a/examples/tutorial-06.rs +++ b/examples/tutorial-06.rs @@ -5,6 +5,7 @@ extern crate image; use std::io::Cursor; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-07.rs b/examples/tutorial-07.rs index 65124a5059e..72e2a47b36a 100644 --- a/examples/tutorial-07.rs +++ b/examples/tutorial-07.rs @@ -5,6 +5,7 @@ extern crate glium; mod teapot; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-08.rs b/examples/tutorial-08.rs index 78933245802..9d8ee9e72dd 100644 --- a/examples/tutorial-08.rs +++ b/examples/tutorial-08.rs @@ -5,6 +5,7 @@ extern crate glium; mod teapot; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-09.rs b/examples/tutorial-09.rs index dd6406bcfc3..496390abae8 100644 --- a/examples/tutorial-09.rs +++ b/examples/tutorial-09.rs @@ -5,6 +5,7 @@ extern crate glium; mod teapot; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-10.rs b/examples/tutorial-10.rs index 49556af6b5c..6648c227b9d 100644 --- a/examples/tutorial-10.rs +++ b/examples/tutorial-10.rs @@ -5,6 +5,7 @@ extern crate glium; mod teapot; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-12.rs b/examples/tutorial-12.rs index 6699f7a0184..8d8ca030d31 100644 --- a/examples/tutorial-12.rs +++ b/examples/tutorial-12.rs @@ -5,6 +5,7 @@ extern crate glium; mod teapot; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-13.rs b/examples/tutorial-13.rs index 826d4cb3dff..41edef394c9 100644 --- a/examples/tutorial-13.rs +++ b/examples/tutorial-13.rs @@ -5,6 +5,7 @@ extern crate glium; mod teapot; fn main() { + #![allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new(); diff --git a/examples/tutorial-14.rs b/examples/tutorial-14.rs index bd40dac0e81..cd376f5b280 100644 --- a/examples/tutorial-14.rs +++ b/examples/tutorial-14.rs @@ -5,6 +5,7 @@ extern crate image; use std::io::Cursor; fn main() { + #[allow(unused_imports)] use glium::{glutin, Surface}; let mut events_loop = glutin::EventsLoop::new();