]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/expect_fun_call.rs
Use source callsite in FormatArgsExpn::inputs_span
[rust.git] / tests / ui / expect_fun_call.rs
index 60bbaa89d42825819edae4191b6d3a3cccaa35fe..22e530b80349d81e27ef8fdeb015acbe54a027a5 100644 (file)
@@ -1,9 +1,16 @@
 // run-rustfix
 
 #![warn(clippy::expect_fun_call)]
+#![allow(clippy::to_string_in_format_args)]
 
 /// Checks implementation of the `EXPECT_FUN_CALL` lint
 
+macro_rules! one {
+    () => {
+        1
+    };
+}
+
 fn main() {
     struct Foo;
 
@@ -30,6 +37,9 @@ fn expect(&self, msg: &str) {
     let with_none_and_as_str: Option<i32> = None;
     with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
 
+    let with_none_and_format_with_macro: Option<i32> = None;
+    with_none_and_format_with_macro.expect(format!("Error {}: fake error", one!()).as_str());
+
     let with_ok: Result<(), ()> = Ok(());
     with_ok.expect("error");