mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Make generate function assist generate a function as a constructor if the name of function is new
This commit is contained in:
parent
7dad0a231e
commit
ff2629d651
2 changed files with 270 additions and 26 deletions
|
@ -1489,6 +1489,14 @@ impl Adt {
|
|||
.map(|arena| arena.1.clone())
|
||||
}
|
||||
|
||||
pub fn as_struct(&self) -> Option<Struct> {
|
||||
if let Self::Struct(v) = self {
|
||||
Some(*v)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_enum(&self) -> Option<Enum> {
|
||||
if let Self::Enum(v) = self {
|
||||
Some(*v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue