From 0e2a111f59ac2fa7abde3c17328684548291737f Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 6 Oct 2020 23:21:56 +0200 Subject: [PATCH] Mark XY::stack_{horizontal, vertical} as must_use (#511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The method names stack_horizontal and stack_vertical don’t make it clear whether the methods modify self or return the modified version. Therefore, it is easy to use them wrong if you don’t look at the documentation. This patch adds the must_use attribute to both methods to make it easier to spot such mistakes. --- cursive-core/src/vec.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cursive-core/src/vec.rs b/cursive-core/src/vec.rs index be03e68..e83a1ea 100644 --- a/cursive-core/src/vec.rs +++ b/cursive-core/src/vec.rs @@ -258,6 +258,7 @@ impl XY { impl + Clone> XY { /// Returns (max(self.x,other.x), self.y+other.y) + #[must_use] pub fn stack_vertical(&self, other: &Self) -> Self { Self::new( max(self.x.clone(), other.x.clone()), @@ -266,6 +267,7 @@ impl + Clone> XY { } /// Returns (self.x+other.x, max(self.y,other.y)) + #[must_use] pub fn stack_horizontal(&self, other: &Self) -> Self { Self::new( self.x.clone() + other.x.clone(),