From dc3304c341ff4f5551cc0f7960f4e56521effd3d Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Fri, 12 Feb 2021 00:00:00 +0000 Subject: Turn may_have_side_effect into an associated constant The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess` trait. It describes if obtaining an iterator element may have side effects. It is currently implemented as an associated function. Turn `may_have_side_effect` into an associated constant. This makes the value immediately available to the optimizer. --- library/alloc/src/vec/into_iter.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'library/alloc/src/vec') diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index f131d06bb18..bcbdffabc7f 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -212,9 +212,7 @@ unsafe impl TrustedRandomAccess for IntoIter where T: Copy, { - fn may_have_side_effect() -> bool { - false - } + const MAY_HAVE_SIDE_EFFECT: bool = false; } #[stable(feature = "vec_into_iter_clone", since = "1.8.0")] -- cgit 1.4.1-3-g733a5