Fix range field order (#56)

* Skip validate_arguments when empty

* Fix `range` field order

* Fix unused variable
This commit is contained in:
Jeong, YunWon 2023-05-18 21:44:01 +09:00 committed by GitHub
parent 531e41ae2c
commit 6c5c311bab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 211 additions and 215 deletions

View file

@ -471,10 +471,10 @@ class StructVisitor(EmitVisitor):
self.emit_attrs(depth)
self.emit(f"pub struct {product_name}<R = TextRange> {{", depth)
self.emit_range(product.attributes, depth + 1)
for f in product.fields:
self.visit(f, type_info, "pub ", depth + 1)
assert bool(product.attributes) == type_info.no_cfg(self.type_info)
self.emit_range(product.attributes, depth + 1)
self.emit("}", depth)
field_names = [f'"{f.name}"' for f in product.fields]
@ -505,7 +505,7 @@ class FoldTraitDefVisitor(EmitVisitor):
self.will_map_user(user)
}
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn will_map_user_cfg(&mut self, user: &crate::EmptyRange<U>) -> crate::EmptyRange<Self::TargetU> {
fn will_map_user_cfg(&mut self, _user: &crate::EmptyRange<U>) -> crate::EmptyRange<Self::TargetU> {
crate::EmptyRange::default()
}
fn map_user(&mut self, user: U, context: Self::UserContext) -> Result<Self::TargetU, Self::Error>;