mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Auto merge of #18038 - roife:fix-issue-18034, r=Veykril
feat: generate names for tuple-struct in add-missing-match-arms fix #18034. This PR includes the following enhancement: - Introduced a `NameGenerator` in `suggest_name`, which implements an automatic renaming algorithm to avoid name conflicts. Here are a few examples: ```rust let mut generator = NameGenerator::new(); assert_eq!(generator.suggest_name("a"), "a"); assert_eq!(generator.suggest_name("a"), "a1"); assert_eq!(generator.suggest_name("a"), "a2"); assert_eq!(generator.suggest_name("b"), "b"); assert_eq!(generator.suggest_name("b"), "b1"); assert_eq!(generator.suggest_name("b2"), "b2"); assert_eq!(generator.suggest_name("b"), "b3"); assert_eq!(generator.suggest_name("b"), "b4"); assert_eq!(generator.suggest_name("b3"), "b5"); ``` - Updated existing testcases in ide-assists for the new `NameGenerator` (only modified generated names). - Generate names for tuple structs instead of using wildcard patterns in `add-missing-match-arms`.
This commit is contained in:
commit
a91ca0e2fc
6 changed files with 295 additions and 102 deletions
|
@ -66,7 +66,7 @@ pub use rowan::{
|
|||
TokenAtOffset, WalkEvent,
|
||||
};
|
||||
pub use rustc_lexer::unescape;
|
||||
pub use smol_str::{format_smolstr, SmolStr, ToSmolStr};
|
||||
pub use smol_str::{format_smolstr, SmolStr, SmolStrBuilder, ToSmolStr};
|
||||
|
||||
/// `Parse` is the result of the parsing: a syntax tree and a collection of
|
||||
/// errors.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue