X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=tests%2Fui%2Fexpect_fun_call.rs;h=22e530b80349d81e27ef8fdeb015acbe54a027a5;hb=4bae06d73c8c53e5b0aabc90203f808932d2b021;hp=60bbaa89d42825819edae4191b6d3a3cccaa35fe;hpb=143ad5e2d10582d2cd1c74d3bee20b14c04af02e;p=rust.git diff --git a/tests/ui/expect_fun_call.rs b/tests/ui/expect_fun_call.rs index 60bbaa89d42..22e530b8034 100644 --- a/tests/ui/expect_fun_call.rs +++ b/tests/ui/expect_fun_call.rs @@ -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 = None; with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str()); + let with_none_and_format_with_macro: Option = None; + with_none_and_format_with_macro.expect(format!("Error {}: fake error", one!()).as_str()); + let with_ok: Result<(), ()> = Ok(()); with_ok.expect("error");