415ba21c3b
[`slow_vector_initialization`]: use the source span of vec![] macro and fix another FP Fixes #11408 <details> <summary>Also fixes a FP when the vec initializer comes from a macro other than `vec![]`</summary> ```rs macro_rules! x { () => { vec![] } } fn f() { let mut v = x!(); v.resize(10, 0); } ``` This shouldn't warn. The `x!` macro might be doing other things, so just replacing `x!()` with `vec![0; 10]` is not always an option. </details> I added some test cases for macro expansions, however I don't think there's a way to write a test for that specific warning that appeared in the linked issue. As far as I understand, that happens when the rust-src rustup component isn't installed (so the stdlib source is unavailable) and the span points to the `vec![]` *expansion*, instead of the `vec![]` that the user wrote. changelog: [`slow_vector_initialization`]: use the source span of `vec![]` macro changelog: [`slow_vector_initialization`]: only warn on `vec![]` expansions and allow other macros