From 267e242238fab0aba14fb4c2e27269ce3a3e3951 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 29 Nov 2019 21:24:52 -0500 Subject: Make many functions `const` The point is to set up repeated components or boilerplate before their use sites. The majority of these make sense as `const`. However, some functions such as those regarding state may not make sense as `const`. --- native/src/layout/limits.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'native/src/layout/limits.rs') diff --git a/native/src/layout/limits.rs b/native/src/layout/limits.rs index 2705a47d..5f456871 100644 --- a/native/src/layout/limits.rs +++ b/native/src/layout/limits.rs @@ -20,7 +20,7 @@ impl Limits { /// /// [`Limits`]: struct.Limits.html /// [`Size`]: ../struct.Size.html - pub fn new(min: Size, max: Size) -> Limits { + pub const fn new(min: Size, max: Size) -> Limits { Limits { min, max, @@ -32,7 +32,7 @@ impl Limits { /// /// [`Limits`]: struct.Limits.html /// [`Size`]: ../struct.Size.html - pub fn min(&self) -> Size { + pub const fn min(&self) -> Size { self.min } @@ -40,7 +40,7 @@ impl Limits { /// /// [`Limits`]: struct.Limits.html /// [`Size`]: ../struct.Size.html - pub fn max(&self) -> Size { + pub const fn max(&self) -> Size { self.max } -- cgit From f81827c151eba868ab17f35d21a654d48125d0bf Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 6 Mar 2020 03:30:48 +0100 Subject: Remove counterintuitive constant functions --- native/src/layout/limits.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'native/src/layout/limits.rs') diff --git a/native/src/layout/limits.rs b/native/src/layout/limits.rs index 5f456871..740417d4 100644 --- a/native/src/layout/limits.rs +++ b/native/src/layout/limits.rs @@ -32,7 +32,7 @@ impl Limits { /// /// [`Limits`]: struct.Limits.html /// [`Size`]: ../struct.Size.html - pub const fn min(&self) -> Size { + pub fn min(&self) -> Size { self.min } @@ -40,7 +40,7 @@ impl Limits { /// /// [`Limits`]: struct.Limits.html /// [`Size`]: ../struct.Size.html - pub const fn max(&self) -> Size { + pub fn max(&self) -> Size { self.max } -- cgit