You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test case is already committed, clippy will complain about examples/todomvc/src/app.rs:
error: field assignment outside of initializer for an instance created with Default::default()
Error: --> examples/todomvc/src/app.rs:66:9
|
66 | / gtk! {
67 | | <Box spacing=10 orientation=Orientation::Vertical>
68 | | <Box spacing=10 orientation=Orientation::Horizontal Box::expand=false>
69 | | <Button image="edit-select-all" relief=ReliefStyle::Half
... |
99 | | </Box>
100 | | }
| |_________^
|
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
note: consider initializing the variable with `radio::Radio<app::Filter> { active: #[proc_macro_hack(support_nested)]
pub use vgtk_macros::gtk, ..Default::default() }` and removing relevant reassignments
--> examples/todomvc/src/app.rs:66:9
|
66 | / gtk! {
67 | | <Box spacing=10 orientation=Orientation::Vertical>
68 | | <Box spacing=10 orientation=Orientation::Horizontal Box::expand=false>
69 | | <Button image="edit-select-all" relief=ReliefStyle::Half
... |
99 | | </Box>
100 | | }
| |_________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
This was found by an unrelated PR (#73). One can silence the warning at the call site (3054df9), but that's not great. @meteficha couldn't find how to make the macro generate a silencing pragma that clippy would respect.
The text was updated successfully, but these errors were encountered:
The problem lies in macros/src/gtk.rs, function expand_component. It's written as:
pubfnexpand_component(gtk:&GtkComponent) -> TokenStream{let name = to_stream(>k.name);letmut out = quote!(use vgtk::{Component, vnode::VComponent, vnode::PropTransform};letmut vcomp = VComponent::new::<#name>();letmut props = <#name asComponent>::Properties::default(););
...// Add lines modifying `props` to `out`.
...
quote!({
#out
vcomp.set_props::<#name>(props);VNode::Component(vcomp)})}
Clippy doesn't like that we have a mut props set to default then changed. It's a silly complaint because it's much harder to generate code that doesn't use default here. I've tried adding #![allow(clippy::field_reassign_with_default)] to the generated code in a few ways, but clippy seemed to always ignore it.
The test case is already committed, clippy will complain about
examples/todomvc/src/app.rs
:This was found by an unrelated PR (#73). One can silence the warning at the call site (3054df9), but that's not great. @meteficha couldn't find how to make the macro generate a silencing pragma that clippy would respect.
The text was updated successfully, but these errors were encountered: