1 //@compile-flags: --crate-name conf_disallowed_methods 2 3 #![allow(clippy::needless_raw_strings)] 4 #![warn(clippy::disallowed_methods)] 5 #![allow(clippy::useless_vec)] 6 7 extern crate futures; 8 extern crate regex; 9 10 use futures::stream::{empty, select_all}; 11 use regex::Regex; 12 local_fn()13fn local_fn() {} 14 15 struct Struct; 16 17 impl Struct { method(&self)18 fn method(&self) {} 19 } 20 21 trait Trait { provided_method(&self)22 fn provided_method(&self) {} implemented_method(&self)23 fn implemented_method(&self); 24 } 25 26 impl Trait for Struct { implemented_method(&self)27 fn implemented_method(&self) {} 28 } 29 30 mod local_mod { f()31 pub fn f() {} 32 } 33 main()34fn main() { 35 let re = Regex::new(r"ab.*c").unwrap(); 36 re.is_match("abc"); 37 38 let mut a = vec![1, 2, 3, 4]; 39 a.iter().sum::<i32>(); 40 41 a.sort_unstable(); 42 43 let _ = 2.0f32.clamp(3.0f32, 4.0f32); 44 let _ = 2.0f64.clamp(3.0f64, 4.0f64); 45 46 let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new; 47 let re = indirect(".").unwrap(); 48 49 let in_call = Box::new(f32::clamp); 50 let in_method_call = ["^", "$"].into_iter().map(Regex::new); 51 52 // resolve ambiguity between `futures::stream::select_all` the module and the function 53 let same_name_as_module = select_all(vec![empty::<()>()]); 54 55 local_fn(); 56 local_mod::f(); 57 let s = Struct; 58 s.method(); 59 s.provided_method(); 60 s.implemented_method(); 61 } 62