Skip to content

Commit

Permalink
Silence unused imports warning in examples
Browse files Browse the repository at this point in the history
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:

rust-lang/rust#58805
  • Loading branch information
est31 committed Apr 15, 2019
1 parent bc9d0cf commit 90937ea
Show file tree
Hide file tree
Showing 32 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/blitting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extern crate glium;
extern crate image;

use std::io::Cursor;
#[allow(unused_imports)]
use glium::{glutin, Surface};

mod support;
Expand Down
1 change: 1 addition & 0 deletions examples/deferred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions examples/displacement_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extern crate image;
extern crate glium;

use std::io::Cursor;
#[allow(unused_imports)]
use glium::{glutin, Surface};

mod support;
Expand Down
1 change: 1 addition & 0 deletions examples/fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions examples/fxaa.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[macro_use]
extern crate glium;

#[allow(unused_imports)]
use glium::{glutin, Surface};

mod support;
Expand Down
1 change: 1 addition & 0 deletions examples/gpgpu.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[macro_use]
extern crate glium;
extern crate rand;
#[allow(unused_imports)]
use glium::glutin;
use glutin::dpi::PhysicalSize;

Expand Down
1 change: 1 addition & 0 deletions examples/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extern crate image;

use std::io::Cursor;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;

Expand Down
1 change: 1 addition & 0 deletions examples/info.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/instancing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;
extern crate rand;

#[allow(unused_imports)]
use glium::{glutin, Surface};

mod support;
Expand Down
1 change: 1 addition & 0 deletions examples/manual-creation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions examples/picking.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[macro_use]
extern crate glium;

#[allow(unused_imports)]
use glium::{glutin, Surface};

mod support;
Expand Down
1 change: 1 addition & 0 deletions examples/screenshot-asynchronous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extern crate image;

use std::thread;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;

Expand Down
3 changes: 2 additions & 1 deletion examples/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;
extern crate image;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;

Expand Down Expand Up @@ -112,7 +113,7 @@ fn main() {
target.finish().unwrap();

// reading the front buffer into an image
let image: glium::texture::RawImage2d<u8> = display.read_front_buffer();
let image: glium::texture::RawImage2d<u8> = 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();
Expand Down
1 change: 1 addition & 0 deletions examples/shadow_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions examples/sprites-batching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;
extern crate rand;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;

Expand Down
1 change: 1 addition & 0 deletions examples/subroutines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extern crate glium;

mod support;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;
use glium::program::ShaderStage;
Expand Down
1 change: 1 addition & 0 deletions examples/teapot.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[macro_use]
extern crate glium;

#[allow(unused_imports)]
use glium::{glutin, Surface};

mod support;
Expand Down
1 change: 1 addition & 0 deletions examples/tessellation.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[macro_use]
extern crate glium;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;

Expand Down
1 change: 1 addition & 0 deletions examples/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extern crate glium;

mod support;

#[allow(unused_imports)]
use glium::{glutin, Surface};
use glium::index::PrimitiveType;

Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-01.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extern crate glium;

fn main() {
#[allow(unused_imports)]
use glium::{glutin, Surface};

let mut events_loop = glutin::EventsLoop::new();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;

fn main() {
#[allow(unused_imports)]
use glium::{glutin, Surface};

let mut events_loop = glutin::EventsLoop::new();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-03.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;

fn main() {
#[allow(unused_imports)]
use glium::{glutin, Surface};

let mut events_loop = glutin::EventsLoop::new();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-04.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;

fn main() {
#[allow(unused_imports)]
use glium::{glutin, Surface};

let mut events_loop = glutin::EventsLoop::new();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-05.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate glium;

fn main() {
#[allow(unused_imports)]
use glium::{glutin, Surface};

let mut events_loop = glutin::EventsLoop::new();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-07.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-08.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial-14.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 90937ea

Please sign in to comment.