]> git.lizzy.rs Git - rust.git/blob - tests/ui/crashes/mut_mut_macro.rs
Auto merge of #6298 - JohnTitor:fix-example, r=llogiq
[rust.git] / tests / ui / crashes / mut_mut_macro.rs
1 #![deny(clippy::mut_mut, clippy::zero_ptr, clippy::cmp_nan)]
2 #![allow(dead_code)]
3
4 // FIXME: compiletest + extern crates doesn't work together. To make this test work, it would need
5 // the following three lines and the lazy_static crate.
6 //
7 //     #[macro_use]
8 //     extern crate lazy_static;
9 //     use std::collections::HashMap;
10
11 /// ensure that we don't suggest `is_nan` and `is_null` inside constants
12 /// FIXME: once const fn is stable, suggest these functions again in constants
13
14 const BAA: *const i32 = 0 as *const i32;
15 static mut BAR: *const i32 = BAA;
16 static mut FOO: *const i32 = 0 as *const i32;
17 static mut BUH: bool = 42.0 < f32::NAN;
18
19 #[allow(unused_variables, unused_mut)]
20 fn main() {
21     /*
22     lazy_static! {
23         static ref MUT_MAP : HashMap<usize, &'static str> = {
24             let mut m = HashMap::new();
25             m.insert(0, "zero");
26             m
27         };
28         static ref MUT_COUNT : usize = MUT_MAP.len();
29     }
30     assert_eq!(*MUT_COUNT, 1);
31     */
32     // FIXME: don't lint in array length, requires `check_body`
33     //let _ = [""; (42.0 < f32::NAN) as usize];
34 }