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
..
2024-07-10 10:43:14 +01:00
2024-07-10 10:43:14 +01:00
2024-07-10 10:43:14 +01:00
2024-07-10 10:43:14 +01:00
2024-07-03 10:41:19 +02:00
2024-07-07 08:40:41 +02:00
2024-06-13 17:29:10 -07:00
2024-07-10 10:43:14 +01:00
2024-07-10 10:43:14 +01:00