Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#16009 - werifu:fix-extract-function, r=Veykril
fix: bug in extract_function.rs There is a little bug in extract_function: It appends `use path::to::ControlFlow;` if the function created contains string "ControlFlow". A case below (also in the test named `does_not_import_control_flow` which will fail in the original code) <img width="322" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/53432474/4b80bb58-0cfd-4d56-b64c-d9649eed336e"> <img width="391" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/53432474/3d7262f4-8a4c-44ea-822d-304b8b23fe28"> Now I have changed the condition determining whether adding import statement. Only when the new function body contains ControlFlow::Break or ControlFlow::Continue can the import statement be added. Last related PR: rust-lang/rust-analyzer#10309
- Loading branch information