3 #![allow(unreachable_code)]
4 #![allow(unused_macros)]
5 #![allow(unused_variables)]
6 #![allow(clippy::assertions_on_constants)]
7 #![allow(clippy::eq_op)]
8 #![warn(clippy::to_string_in_format_args)]
10 use std::io::{stdout, Write};
12 use std::panic::Location;
16 impl ToString for Somewhere {
17 fn to_string(&self) -> String {
18 String::from("somewhere")
27 fn deref(&self) -> &u32 {
34 impl<'a> Deref for Y<'a> {
37 fn deref(&self) -> &Self::Target {
47 fn deref(&self) -> &u32 {
52 impl std::fmt::Display for Z {
53 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
58 macro_rules! my_macro {
60 // here be dragons, do not enter (or lint)
61 println!("error: something failed at {}", Location::caller().to_string());
65 macro_rules! my_other_macro {
67 Location::caller().to_string()
75 let _ = format!("error: something failed at {}", Location::caller().to_string());
78 "error: something failed at {}",
79 Location::caller().to_string()
83 "error: something failed at {}",
84 Location::caller().to_string()
86 print!("error: something failed at {}", Location::caller().to_string());
87 println!("error: something failed at {}", Location::caller().to_string());
88 eprint!("error: something failed at {}", Location::caller().to_string());
89 eprintln!("error: something failed at {}", Location::caller().to_string());
90 let _ = format_args!("error: something failed at {}", Location::caller().to_string());
91 assert!(true, "error: something failed at {}", Location::caller().to_string());
92 assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string());
93 assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string());
94 panic!("error: something failed at {}", Location::caller().to_string());
95 println!("{}", X(1).to_string());
96 println!("{}", Y(&X(1)).to_string());
97 println!("{}", Z(1).to_string());
98 println!("{}", x.to_string());
99 println!("{}", x_ref.to_string());
101 println!("error: something failed at {}", Somewhere.to_string());
102 println!("{} and again {0}", x.to_string());
104 println!("error: something failed at {}", my_other_macro!());