use SyntaxKind instead of "Self" literal comparison
This commit is contained in:
parent
67f001e5ec
commit
a38a79e2ba
@ -250,24 +250,21 @@ fn create_struct_def(
|
|||||||
field_list
|
field_list
|
||||||
.fields()
|
.fields()
|
||||||
.filter_map(|field| match field.ty()? {
|
.filter_map(|field| match field.ty()? {
|
||||||
ast::Type::PathType(p) => {
|
ast::Type::PathType(p) => Some(
|
||||||
let generic_arg_list = p.path()?.segment()?.generic_arg_list()?;
|
p.syntax()
|
||||||
Some(
|
.descendants_with_tokens()
|
||||||
generic_arg_list
|
.filter_map(|it| {
|
||||||
.generic_args()
|
if it.kind() == T![Self] {
|
||||||
.filter_map(|generic_arg| {
|
let type_arg =
|
||||||
if generic_arg.to_string() == "Self" {
|
make::type_arg(make::ty(&enum_.name()?.to_string()))
|
||||||
let type_arg =
|
.clone_for_update();
|
||||||
make::type_arg(make::ty(&enum_.name()?.to_string()))
|
Some(ted::replace(it, type_arg.syntax()))
|
||||||
.clone_for_update();
|
} else {
|
||||||
Some(ted::replace(generic_arg.syntax(), type_arg.syntax()))
|
None
|
||||||
} else {
|
}
|
||||||
None
|
})
|
||||||
}
|
.count(),
|
||||||
})
|
),
|
||||||
.count(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.count();
|
.count();
|
||||||
|
Loading…
Reference in New Issue
Block a user