Skip to content

code: clone macro: Use convenience attributes instead of upgrade_or_else

Fina Wilke requested to merge felinira/loupe:wip/fina/clone-macro-style into main

For Copy types the glib::clone! macro has a simpler syntax #[upgrade_or]. For types that implement Default we can use #[upgrade_or_default].

Uses #[upgrade_or_default] for Option::None, but #[upgrade_or] false for bool types. We could use upgrade_or_default for bools too, but it might be too unexpected.

Merge request reports

Loading