From 457e0c5affe15d50a91cf002631a29817486f3a4 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Thu, 13 Nov 2025 23:10:22 +0100 Subject: [PATCH] must_use --- src/moves.rs | 2 ++ src/position.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/moves.rs b/src/moves.rs index 1492c28..ebf416c 100644 --- a/src/moves.rs +++ b/src/moves.rs @@ -11,6 +11,7 @@ use std::iter::ExactSizeIterator; use std::iter::FusedIterator; /// A legal move. +#[must_use] #[derive(Clone, Copy)] pub struct Move<'l> { position: &'l Position, @@ -199,6 +200,7 @@ impl<'l> Move<'l> { /// /// It can be obtained using the [`Position::legal_moves`] method. This type is an iterator over /// [`Move`] objects. +#[must_use] pub struct Moves<'l> { position: &'l Position, is_check: bool, diff --git a/src/position.rs b/src/position.rs index c69787f..01ad1c9 100644 --- a/src/position.rs +++ b/src/position.rs @@ -54,6 +54,7 @@ use std::iter::FusedIterator; /// The order on [`Position`] is defined only for use in data structures. Hence its only /// requirement is to be efficient while respecting the [`Ord`] trait protocol. It should not be /// considered stable. +#[must_use] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Position(Setup); @@ -91,6 +92,7 @@ impl Position { /// position.legal_moves().len() /// # }; /// ``` + #[must_use] #[inline] pub fn count_legal_moves(&self) -> usize { struct MoveGenImpl {