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