mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-10 20:28:51 +00:00
Auto merge of #112043 - jieyouxu:suggestion_macro_expansion_source_callsites, r=cjgillot
Fix suggestion spans for expr from macro expansions ### Issue #112007: rustc shows expanded `writeln!` macro in code suggestion #### Before This PR ``` help: consider using a semicolon here | 6 | }; | + help: you might have meant to return this value --> C:\Users\hayle\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\macros\mod.rs:557:9 | 55| return $dst.write_fmt($crate::format_args_nl!($($arg)*)); | ++++++ + ``` #### After This PR ``` help: consider using a semicolon here | LL | }; | + help: you might have meant to return this value | LL | return writeln!(w, "but not here"); | ++++++ + ``` ### Issue #110017: `format!` `.into()` suggestion deletes the `format` macro #### Before This PR ``` help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>` --> /Users/eric/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/macros.rs:121:12 | 12| res.into() | +++++++ ``` #### After This PR ``` help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>` | LL | Err(format!("error: {x}").into()) | +++++++ ``` --- Fixes #112007. Fixes #110017.
This commit is contained in:
commit
23f8bdef61