Auto merge of #82043 - tmiasko:may-have-side-effect, r=kennytm
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.
This commit is contained in:
@@ -321,10 +321,7 @@ unsafe impl TrustedLen for Bytes<'_> {}
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "trusted_random_access", issue = "none")]
|
||||
unsafe impl TrustedRandomAccess for Bytes<'_> {
|
||||
#[inline]
|
||||
fn may_have_side_effect() -> bool {
|
||||
false
|
||||
}
|
||||
const MAY_HAVE_SIDE_EFFECT: bool = false;
|
||||
}
|
||||
|
||||
/// This macro generates a Clone impl for string pattern API
|
||||
|
||||
Reference in New Issue
Block a user