rust-analyzer/crates
bors 5577e4e3b1 Auto merge of #17571 - winstxnhdw:bool-to-enum-no-dupe, r=Veykril
feat: do not add new enum if it already exists

## Summary

This PR introduces a check for the existence of another enum within the current scope, and if it exist, we skip `add_enum_def`.

## Why?

Currently, when using the `bool_to_enum` assist more than once, it is possible to add multiple enum definitions. For example, the following snippet,

```rs
#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

fn main() {
    let a = Bool::True;
    let b = true;
    println!("Hello, world!");
}
```

will be transformed into,

```rs
#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

fn main() {
    let a = Bool::True;
    let b = Bool::True;
    println!("Hello, world!");
}
```

This can be annoying for users to clean up.
2024-07-11 08:55:34 +00:00
..
base-db Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
cfg Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
flycheck Add --keep-going to the check command 2024-07-07 18:37:02 +02:00
hir Add f16 and f128 support 2024-07-10 10:43:14 +01:00
hir-def Add f16 and f128 support 2024-07-10 10:43:14 +01:00
hir-expand Add f16 and f128 support 2024-07-10 10:43:14 +01:00
hir-ty Add f16 and f128 support 2024-07-10 10:43:14 +01:00
ide Auto merge of #17572 - beetrees:f16-f128, r=Veykril 2024-07-10 10:04:30 +00:00
ide-assists refactor: search for enum semantically 2024-07-10 21:13:13 +01:00
ide-completion Auto merge of #17555 - Veykril:grammar-inline, r=Veykril 2024-07-07 09:21:04 +00:00
ide-db Auto merge of #17555 - Veykril:grammar-inline, r=Veykril 2024-07-07 09:21:04 +00:00
ide-diagnostics Auto merge of #17523 - wada314:master, r=Veykril 2024-07-07 08:32:46 +00:00
ide-ssr Auto merge of #17555 - Veykril:grammar-inline, r=Veykril 2024-07-07 09:21:04 +00:00
intern Fix new clippy lints 2024-04-01 17:55:56 +02:00
limit Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
load-cargo fix: ensure there are no cycles in the source_root_parent_map 2024-06-20 13:46:14 +08:00
mbe Fix up the syntax tree for macro 2.0 2024-07-03 10:41:19 +02:00
parser Run codegen commands as tests if their results are commited 2024-07-07 09:14:50 +02:00
paths Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
proc-macro-api Improve error message when the proc-macro server unexpectedly exits 2024-07-01 14:30:21 +02:00
proc-macro-srv Improve error message when the proc-macro server unexpectedly exits 2024-07-01 14:30:21 +02:00
proc-macro-srv-cli Abstract proc-macro-srv protocol format 2024-06-30 16:56:30 +02:00
profile Fix stop_watch on linux 2024-07-07 08:40:41 +02:00
project-model Remove version check before using --keep-going 2024-07-08 16:41:12 +02:00
rust-analyzer Remove dead code in config.rs 2024-07-10 11:49:11 +02:00
salsa Auto merge of #17417 - Wilfred:intern_macros_salsa, r=Veykril 2024-06-14 06:20:26 +00:00
span internal: Fix rustdoc warnings 2024-06-13 17:29:10 -07:00
stdx Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
syntax Add f16 and f128 support 2024-07-10 10:43:14 +01:00
test-fixture style: simplify string interpolation 2024-05-30 16:18:49 -07:00
test-utils Add f16 and f128 support 2024-07-10 10:43:14 +01:00
text-edit Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
toolchain Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
tt Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
vfs Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
vfs-notify Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00