idanarye / rust-smart-default

Rust macro for automatically generating default
MIT License
133 stars 7 forks source link

v0.7: can't set the default for `bool` field #13

Closed MaxVerevkin closed 1 year ago

MaxVerevkin commented 1 year ago
use smart_default::SmartDefault;

fn main() {
    dbg!(S::default());
}

#[derive(Debug, SmartDefault)]
struct S {
    #[default(1)] // works
    i: i32,
    #[default(true)] // error: Expected single value in #[default(...)]
    b: bool,
}
tyranron commented 1 year ago

Have similar error with #[default(Coloring::Auto)] attribute.

tyranron commented 1 year ago

The regression popped up here, the error migrated to another if branch, causing to fire early.