File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1001,14 +1001,14 @@ macro_rules! impl_ranged {
1001
1001
1002
1002
/// Returns `true` if the value is the niche value.
1003
1003
#[ inline( always) ]
1004
- pub const fn is_none( self ) -> bool {
1004
+ pub const fn is_none( & self ) -> bool {
1005
1005
<$type<MIN , MAX > as $crate:: traits:: RangeIsValid >:: ASSERT ;
1006
1006
self . get( ) . is_none( )
1007
1007
}
1008
1008
1009
1009
/// Returns `true` if the value is not the niche value.
1010
1010
#[ inline( always) ]
1011
- pub const fn is_some( self ) -> bool {
1011
+ pub const fn is_some( & self ) -> bool {
1012
1012
<$type<MIN , MAX > as $crate:: traits:: RangeIsValid >:: ASSERT ;
1013
1013
self . get( ) . is_some( )
1014
1014
}
Original file line number Diff line number Diff line change @@ -147,6 +147,18 @@ macro_rules! tests {
147
147
assert!( $opt:: <5 , 10 >:: None . is_none( ) ) ;
148
148
) * }
149
149
150
+ #[ test]
151
+ fn is_some_by_ref( ) { $(
152
+ let value = $opt:: <5 , 10 >:: Some ( $t:: <5 , 10 >:: MAX ) ;
153
+ assert!( $opt:: is_some( & value) ) ;
154
+ ) * }
155
+
156
+ #[ test]
157
+ fn is_none_by_ref( ) { $(
158
+ let value = $opt:: <5 , 10 >:: None ;
159
+ assert!( $opt:: is_none( & value) ) ;
160
+ ) * }
161
+
150
162
#[ test]
151
163
fn default ( ) { $(
152
164
assert_eq!( $opt:: <5 , 10 >:: default ( ) , $opt:: <5 , 10 >:: None ) ;
You can’t perform that action at this time.
0 commit comments