From a8a47583a75b044c0293515ace05cf59999843d8 Mon Sep 17 00:00:00 2001 From: Lars Bergstrom Date: Tue, 4 Mar 2014 08:42:32 -0800 Subject: [PATCH 1/2] Rust upgrade --- alert.rc | 4 ++-- test.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alert.rc b/alert.rc index 69a3ac4..0b75e11 100644 --- a/alert.rc +++ b/alert.rc @@ -11,9 +11,9 @@ #[crate_type = "lib"]; #[cfg(target_os="macos")] -extern mod core_foundation; +extern crate core_foundation; #[cfg(target_os="macos")] -extern mod cocoa; +extern crate cocoa; #[cfg(target_os="linux")] pub use linux::Alert; diff --git a/test.rs b/test.rs index 43a7d06..037c1a5 100644 --- a/test.rs +++ b/test.rs @@ -20,13 +20,13 @@ use core::task; pub fn main() { let mut builder = task::task(); builder.sched_mode(PlatformThread); - do builder.spawn { + builder.spawn(|| { init(); let mut alert: Alert = AlertMethods::new("All units destroyed."); alert.add_prompt(); alert.run() - } + }); } #[cfg(target_os="macos")] From c0b26d9fd61fbf05dd2839134b3a1a1a1628b423 Mon Sep 17 00:00:00 2001 From: Lars Bergstrom Date: Thu, 13 Mar 2014 18:52:38 -0500 Subject: [PATCH 2/2] Rust upgrade --- linux.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/linux.rs b/linux.rs index d17c9ac..7934339 100644 --- a/linux.rs +++ b/linux.rs @@ -9,7 +9,7 @@ use AlertMethods; use std::io; -use std::io::buffered::BufferedReader; +use std::io::BufferedReader; /// An alert. pub struct Alert { @@ -23,9 +23,12 @@ impl AlertMethods for Alert { } fn add_prompt(&mut self) { - print("URL: "); - self.url = BufferedReader::new(io::stdin()) - .read_line().expect("Could not read URL from stdin"); + println!("URL: "); + self.url = match BufferedReader::new(io::stdin()).read_line() { + Ok(res) => res, + _ => fail!("Could not read URL from stdin"), + + } } fn run(&self) {