From cb32e64b72e9342d30cde694ab25234a263cab59 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Sat, 11 Oct 2014 17:58:17 +0200 Subject: [PATCH] Fix warnings while compiling for win32 --- src/win32/init.rs | 9 +++++---- src/win32/mod.rs | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/win32/init.rs b/src/win32/init.rs index 740bc023..e50fc5d4 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -24,7 +24,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin // initializing variables to be sent to the task let title = builder_title.as_slice().utf16_units() - .collect::>().append_one(0); // title to utf16 + .chain(Some(0).into_iter()).collect::>(); // title to utf16 //let hints = hints.clone(); let (tx, rx) = channel(); @@ -34,8 +34,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin TaskBuilder::new().native().spawn(proc() { // registering the window class let class_name = { - let class_name: Vec = "Window Class".utf16_units().collect::>() - .append_one(0); + let class_name: Vec = "Window Class".utf16_units().chain(Some(0).into_iter()) + .collect::>(); let class = ffi::WNDCLASSEX { cbSize: mem::size_of::() as ffi::UINT, @@ -333,7 +333,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin // loading the opengl32 module let gl_library = { - let name = "opengl32.dll".utf16_units().collect::>().append_one(0).as_ptr(); + let name = "opengl32.dll".utf16_units().chain(Some(0).into_iter()) + .collect::>().as_ptr(); let lib = unsafe { ffi::LoadLibraryW(name) }; if lib.is_null() { tx.send(Err(format!("LoadLibrary function failed: {}", diff --git a/src/win32/mod.rs b/src/win32/mod.rs index af280116..720010c1 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -85,7 +85,8 @@ impl Window { pub fn set_title(&self, text: &str) { unsafe { ffi::SetWindowTextW(self.window, - text.utf16_units().collect::>().append_one(0).as_ptr() as ffi::LPCWSTR); + text.utf16_units().chain(Some(0).into_iter()) + .collect::>().as_ptr() as ffi::LPCWSTR); } }