Skip to content

Commit

Permalink
Merge pull request PistonDevelopers#280 from csherratt/master
Browse files Browse the repository at this point in the history
Fix unwrap() in examples
  • Loading branch information
brendanzab committed Jan 25, 2015
2 parents 7eb8684 + bc1b352 commit 17eb8ac
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::{Action, Context, Key};

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

let (mut window, events) = glfw.create_window(300, 300, "Clipboard Test", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");
Expand Down
2 changes: 1 addition & 1 deletion examples/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::{Action, Context, CursorMode, Key};

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

let (mut window, events) = glfw.create_window(800, 600, "Hello, I am a window.", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");
Expand Down
2 changes: 1 addition & 1 deletion examples/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::Context;

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

glfw.window_hint(glfw::WindowHint::Visible(true));

Expand Down
2 changes: 1 addition & 1 deletion examples/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn main() {
f: error_callback as fn(glfw::Error, String, &Cell<usize>),
data: Cell::new(0),
}
)).unwrap();
)).ok().expect("Failed to init glfw");

// Force the error callback to be triggered
glfw.window_hint(glfw::WindowHint::ContextVersion(40000, 3000)); // Ridiculous!
Expand Down
2 changes: 1 addition & 1 deletion examples/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::{Action, Context, Key};

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

glfw.window_hint(glfw::WindowHint::Resizable(true));

Expand Down
2 changes: 1 addition & 1 deletion examples/modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
extern crate glfw;

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

glfw.with_primary_monitor(|_, monitor| {
let _ = monitor.map(|monitor| {
Expand Down
2 changes: 1 addition & 1 deletion examples/monitors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::{Action, Context, Key};

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

glfw.with_connected_monitors(|_, monitors| {
for monitor in monitors.iter() {
Expand Down
2 changes: 1 addition & 1 deletion examples/render_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use glfw::{Action, Context, Key};
use std::thread::Builder;

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

let (mut window, events) = glfw.create_window(300, 300, "Hello this is window", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");
Expand Down
2 changes: 1 addition & 1 deletion examples/title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::{Action, Context, Key};

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

let (mut window, events) = glfw.create_window(400, 400, "English 日本語 русский язык 官話", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");
Expand Down
2 changes: 1 addition & 1 deletion examples/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate glfw;
use glfw::{Action, Context, Key};

fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");

let (mut window, events) = glfw.create_window(300, 300, "Hello this is window", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//! use glfw::{Action, Context, Key};
//!
//! fn main() {
//! let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
//! let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");
//!
//! // Create a windowed mode window and its OpenGL context
//! let (mut window, events) = glfw.create_window(300, 300, "Hello this is window", glfw::WindowMode::Windowed)
Expand Down Expand Up @@ -377,7 +377,7 @@ pub enum InitError {
/// extern crate glfw;
///
/// fn main() {
/// let glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
/// let glfw = glfw::init(glfw::FAIL_ON_ERRORS).ok().expect("Failed to init glfw");
/// }
/// ~~~
///
Expand Down

0 comments on commit 17eb8ac

Please sign in to comment.