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| {
|
|
||||||
if generic_arg.to_string() == "Self" {
|
|
||||||
let type_arg =
|
let type_arg =
|
||||||
make::type_arg(make::ty(&enum_.name()?.to_string()))
|
make::type_arg(make::ty(&enum_.name()?.to_string()))
|
||||||
.clone_for_update();
|
.clone_for_update();
|
||||||
Some(ted::replace(generic_arg.syntax(), type_arg.syntax()))
|
Some(ted::replace(it, type_arg.syntax()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.count(),
|
.count(),
|
||||||
)
|
),
|
||||||
}
|
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.count();
|
.count();
|
||||||
|
Loading…
Reference in New Issue
Block a user