Skip to content

Commit

Permalink
Fix and un-allow clippy::return_self_not_must_use lints (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Dec 18, 2024
1 parent a6a6da0 commit 2f2bcad
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
single_use_lifetimes,
unnameable_types,
unreachable_pub,
clippy::return_self_not_must_use,
clippy::cast_possible_truncation,
clippy::missing_assert_message,
clippy::shadow_unrelated,
Expand Down
7 changes: 7 additions & 0 deletions vello/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ impl<'a> DrawGlyphs<'a> {
/// translation.
///
/// The default value is the identity matrix.
#[must_use]
pub fn transform(mut self, transform: Affine) -> Self {
self.run.transform = Transform::from_kurbo(&transform);
self
Expand All @@ -379,6 +380,7 @@ impl<'a> DrawGlyphs<'a> {
/// an oblique font.
///
/// The default value is `None`.
#[must_use]
pub fn glyph_transform(mut self, transform: Option<Affine>) -> Self {
self.run.glyph_transform = transform.map(|xform| Transform::from_kurbo(&xform));
self
Expand All @@ -387,6 +389,7 @@ impl<'a> DrawGlyphs<'a> {
/// Sets the font size in pixels per em units.
///
/// The default value is 16.0.
#[must_use]
pub fn font_size(mut self, size: f32) -> Self {
self.run.font_size = size;
self
Expand All @@ -395,12 +398,14 @@ impl<'a> DrawGlyphs<'a> {
/// Sets whether to enable hinting.
///
/// The default value is `false`.
#[must_use]
pub fn hint(mut self, hint: bool) -> Self {
self.run.hint = hint;
self
}

/// Sets the normalized design space coordinates for a variable font instance.
#[must_use]
pub fn normalized_coords(mut self, coords: &[NormalizedCoord]) -> Self {
self.scene
.encoding
Expand All @@ -419,6 +424,7 @@ impl<'a> DrawGlyphs<'a> {
/// Sets the brush.
///
/// The default value is solid black.
#[must_use]
pub fn brush(mut self, brush: impl Into<BrushRef<'a>>) -> Self {
self.brush = brush.into();
self
Expand All @@ -427,6 +433,7 @@ impl<'a> DrawGlyphs<'a> {
/// Sets an additional alpha multiplier for the brush.
///
/// The default value is 1.0.
#[must_use]
pub fn brush_alpha(mut self, alpha: f32) -> Self {
self.brush_alpha = alpha;
self
Expand Down
1 change: 1 addition & 0 deletions vello_encoding/src/clip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl ClipBic {
/// operation, it represents doing the pops of `self`, the pushes of
/// `self`, the pops of `other`, and the pushes of `other`. The middle
/// two can cancel each other out.
#[must_use]
pub fn combine(self, other: Self) -> Self {
let m = self.b.min(other.a);
Self::new(self.a + other.a - m, self.b + other.b - m)
Expand Down
1 change: 0 additions & 1 deletion vello_encoding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#![expect(
missing_debug_implementations,
single_use_lifetimes,
clippy::return_self_not_must_use,
clippy::cast_possible_truncation,
clippy::missing_assert_message,
clippy::missing_panics_doc,
Expand Down
1 change: 1 addition & 0 deletions vello_encoding/src/monoid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ pub trait Monoid: Default {
fn new(value: Self::SourceValue) -> Self;

/// Combines two monoids. This operation must be associative.
#[must_use]
fn combine(&self, other: &Self) -> Self;
}

0 comments on commit 2f2bcad

Please sign in to comment.