about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2019-08-12 16:00:10 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2019-08-12 16:00:10 +0200
commitf5b0a68fbfbaa542becc269b64e99efb5c9abaec (patch)
tree3b2a9d029ae8b779d9d4968d594e77ecb4e41ae6 /example
parent314141392a6f97471ec6fc46a7a10053dacf59e9 (diff)
downloadrust-f5b0a68fbfbaa542becc269b64e99efb5c9abaec.tar.gz
rust-f5b0a68fbfbaa542becc269b64e99efb5c9abaec.zip
Fix some warnings
Diffstat (limited to 'example')
-rw-r--r--example/arbitrary_self_types_pointers_and_wrappers.rs1
-rw-r--r--example/mini_core.rs1
-rw-r--r--example/mini_core_hello_world.rs6
-rw-r--r--example/std_example.rs14
4 files changed, 10 insertions, 12 deletions
diff --git a/example/arbitrary_self_types_pointers_and_wrappers.rs b/example/arbitrary_self_types_pointers_and_wrappers.rs
index 5e7d4762179..10934cebcf1 100644
--- a/example/arbitrary_self_types_pointers_and_wrappers.rs
+++ b/example/arbitrary_self_types_pointers_and_wrappers.rs
@@ -9,7 +9,6 @@
 extern crate mini_core;
 
 use mini_core::*;
-use mini_core::libc::*;
 
 macro_rules! assert_eq {
     ($l:expr, $r: expr) => {
diff --git a/example/mini_core.rs b/example/mini_core.rs
index 84664eb4139..fc31daf596f 100644
--- a/example/mini_core.rs
+++ b/example/mini_core.rs
@@ -430,6 +430,7 @@ pub trait Drop {
     fn drop(&mut self);
 }
 
+#[allow(unions_with_drop_fields)]
 pub union MaybeUninit<T> {
     pub uninit: (),
     pub value: T,
diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs
index 48ae80baaad..47d046d0e1b 100644
--- a/example/mini_core_hello_world.rs
+++ b/example/mini_core_hello_world.rs
@@ -149,7 +149,7 @@ fn main() {
 
         let world: Box<&str> = box "World!\0";
         puts(*world as *const str as *const u8);
-        world as Box<SomeTrait>;
+        world as Box<dyn SomeTrait>;
 
         assert_eq!(intrinsics::bitreverse(0b10101000u8), 0b00010101u8);
 
@@ -212,7 +212,7 @@ fn main() {
     let _ = box NoisyDrop {
         text: "Boxed outer got dropped!\0",
         inner: NoisyDropInner,
-    } as Box<SomeTrait>;
+    } as Box<dyn SomeTrait>;
 
     const FUNC_REF: Option<fn()> = Some(main);
     match FUNC_REF {
@@ -249,5 +249,5 @@ fn main() {
 
     unsafe { assert_eq!(ABC as usize, 0); }
 
-    &mut (|| Some(0 as *const ())) as &mut FnMut() -> Option<*const ()>;
+    &mut (|| Some(0 as *const ())) as &mut dyn FnMut() -> Option<*const ()>;
 }
diff --git a/example/std_example.rs b/example/std_example.rs
index c0f236055ab..7d1d8facdbe 100644
--- a/example/std_example.rs
+++ b/example/std_example.rs
@@ -2,12 +2,10 @@
 
 use std::arch::x86_64::*;
 use std::io::Write;
-use std::intrinsics;
-
 
 fn main() {
     let mutex = std::sync::Mutex::new(());
-    mutex.lock().unwrap();
+    let _guard = mutex.lock().unwrap();
 
     let _ = ::std::iter::repeat('a' as u8).take(10).collect::<Vec<_>>();
     let stderr = ::std::io::stderr();
@@ -19,10 +17,10 @@ fn main() {
 
     println!("cargo:rustc-link-lib=z");
 
-    static ONCE: std::sync::Once = std::sync::ONCE_INIT;
+    static ONCE: std::sync::Once = std::sync::Once::new();
     ONCE.call_once(|| {});
 
-    LoopState::Continue(()) == LoopState::Break(());
+    let _eq = LoopState::Continue(()) == LoopState::Break(());
 
     // Make sure ByValPair values with differently sized components are correctly passed
     map(None::<(u8, Box<Instruction>)>);
@@ -41,8 +39,8 @@ fn main() {
     assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26);
     assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);
 
-    0i128.checked_div(2i128);
-    0u128.checked_div(2u128);
+    let _d = 0i128.checked_div(2i128);
+    let _d = 0u128.checked_div(2u128);
     assert_eq!(1u128 + 2, 3);
 
     assert_eq!(0b100010000000000000000000000000000u128 >> 10, 0b10001000000000000000000u128);
@@ -165,7 +163,7 @@ unsafe fn test_mm_add_pd() {
 
 fn assert_eq_m128i(x: std::arch::x86_64::__m128i, y: std::arch::x86_64::__m128i) {
     unsafe {
-        assert_eq!(std::mem::transmute::<_, [u8; 16]>(x), std::mem::transmute::<_, [u8; 16]>(x));
+        assert_eq!(std::mem::transmute::<_, [u8; 16]>(x), std::mem::transmute::<_, [u8; 16]>(y));
     }
 }