diff --git a/api/sixtyfps-rs/lib.rs b/api/sixtyfps-rs/lib.rs index a88f6d9b2..8ffd505b1 100644 --- a/api/sixtyfps-rs/lib.rs +++ b/api/sixtyfps-rs/lib.rs @@ -530,6 +530,7 @@ pub trait ComponentHandle { Self: Sized; /// Returns a clone of this handle that's a strong reference. + #[must_use] fn clone_strong(&self) -> Self; /// Internal function used when upgrading a weak reference to a strong one. diff --git a/api/sixtyfps-rs/sixtyfps-build/lib.rs b/api/sixtyfps-rs/sixtyfps-build/lib.rs index 7613bbdfa..514aaa881 100644 --- a/api/sixtyfps-rs/sixtyfps-build/lib.rs +++ b/api/sixtyfps-rs/sixtyfps-build/lib.rs @@ -73,6 +73,7 @@ impl CompilerConfiguration { /// Create a new configuration that includes sets the include paths used for looking up /// `.60` imports to the specified vector of paths. + #[must_use] pub fn with_include_paths(self, include_paths: Vec) -> Self { let mut config = self.config; config.include_paths = include_paths; @@ -80,6 +81,7 @@ impl CompilerConfiguration { } /// Create a new configuration that selects the style to be used for widgets. + #[must_use] pub fn with_style(self, style: String) -> Self { let mut config = self.config; config.style = Some(style); diff --git a/sixtyfps_compiler/diagnostics.rs b/sixtyfps_compiler/diagnostics.rs index b4773d26f..216af1fa4 100644 --- a/sixtyfps_compiler/diagnostics.rs +++ b/sixtyfps_compiler/diagnostics.rs @@ -469,6 +469,7 @@ impl BuildDiagnostics { } #[cfg(feature = "display-diagnostics")] + #[must_use] pub fn check_and_exit_on_error(self) -> Self { if self.has_error() { self.print(); diff --git a/sixtyfps_compiler/expression_tree.rs b/sixtyfps_compiler/expression_tree.rs index f79ac018c..730fac6e5 100644 --- a/sixtyfps_compiler/expression_tree.rs +++ b/sixtyfps_compiler/expression_tree.rs @@ -839,6 +839,7 @@ impl Expression { } /// Create a conversion node if needed, or throw an error if the type is not matching + #[must_use] pub fn maybe_convert_to( self, target_type: Type, diff --git a/sixtyfps_runtime/corelib/graphics.rs b/sixtyfps_runtime/corelib/graphics.rs index b85c6a674..28ad54312 100644 --- a/sixtyfps_runtime/corelib/graphics.rs +++ b/sixtyfps_runtime/corelib/graphics.rs @@ -142,6 +142,7 @@ pub struct FontRequest { impl FontRequest { /// Consumes the FontRequest, replaces any missing fields from the specified other request and /// returns the new request. + #[must_use] pub fn merge(self, other: &FontRequest) -> Self { Self { family: self.family.or_else(|| other.family.clone()), diff --git a/sixtyfps_runtime/corelib/graphics/color.rs b/sixtyfps_runtime/corelib/graphics/color.rs index 5e41ee2b4..4ee7961d0 100644 --- a/sixtyfps_runtime/corelib/graphics/color.rs +++ b/sixtyfps_runtime/corelib/graphics/color.rs @@ -170,6 +170,7 @@ impl Color { /// The result is converted back to RGB and the alpha channel is unchanged. /// So for example `brighter(0.2)` will increase the brightness by 20%, and /// calling `brighter(-0.5)` will return a color that's 50% darker. + #[must_use] pub fn brighter(&self, factor: f32) -> Self { let rgba: RgbaColor = (*self).into(); let mut hsva: HsvaColor = rgba.into(); @@ -183,6 +184,7 @@ impl Color { /// color space and dividing the brightness (value) by (1 + factor). The /// result is converted back to RGB and the alpha channel is unchanged. /// So for example `darker(0.3)` will decrease the brightness by 30%. + #[must_use] pub fn darker(&self, factor: f32) -> Self { let rgba: RgbaColor = (*self).into(); let mut hsva: HsvaColor = rgba.into(); diff --git a/sixtyfps_runtime/corelib/layout.rs b/sixtyfps_runtime/corelib/layout.rs index c4531f926..cfca85e0e 100644 --- a/sixtyfps_runtime/corelib/layout.rs +++ b/sixtyfps_runtime/corelib/layout.rs @@ -53,6 +53,7 @@ impl Default for LayoutInfo { impl LayoutInfo { // Note: This "logic" is duplicated in the cpp generator's generated code for merging layout infos. + #[must_use] pub fn merge(&self, other: &LayoutInfo) -> Self { Self { min: self.min.max(other.min), diff --git a/sixtyfps_runtime/corelib/properties.rs b/sixtyfps_runtime/corelib/properties.rs index 0420c8513..9e087f248 100644 --- a/sixtyfps_runtime/corelib/properties.rs +++ b/sixtyfps_runtime/corelib/properties.rs @@ -1228,6 +1228,7 @@ pub trait InterpolatedPropertyValue: PartialEq + Default + 'static { /// Returns the interpolated value between self and target_value according to the /// progress parameter t that's usually between 0 and 1. With certain animation /// easing curves it may over- or undershoot though. + #[must_use] fn interpolate(&self, target_value: &Self, t: f32) -> Self; } diff --git a/sixtyfps_runtime/interpreter/api.rs b/sixtyfps_runtime/interpreter/api.rs index 6a1b0b18d..8f2930453 100644 --- a/sixtyfps_runtime/interpreter/api.rs +++ b/sixtyfps_runtime/interpreter/api.rs @@ -992,6 +992,7 @@ impl ComponentInstance { /// Clone is not implemented because of the danger of circular reference: /// If you want to use this instance in a callback, you should capture a weak /// reference given by [`Self::as_weak`]. + #[must_use] pub fn clone_strong(&self) -> Self { Self { inner: self.inner.clone() } }