31
31
#![ feature( restricted_std) ]
32
32
#![ feature( rustc_attrs) ]
33
33
#![ feature( min_specialization) ]
34
+ #![ feature( bound_cloned) ]
34
35
#![ recursion_limit = "256" ]
35
36
36
37
#[ unstable( feature = "proc_macro_internals" , issue = "27812" ) ]
@@ -43,7 +44,7 @@ mod diagnostic;
43
44
pub use diagnostic:: { Diagnostic , Level , MultiSpan } ;
44
45
45
46
use std:: cmp:: Ordering ;
46
- use std:: ops:: { Bound , RangeBounds } ;
47
+ use std:: ops:: RangeBounds ;
47
48
use std:: path:: PathBuf ;
48
49
use std:: str:: FromStr ;
49
50
use std:: { error, fmt, iter, mem} ;
@@ -1162,16 +1163,7 @@ impl Literal {
1162
1163
// was 'c' or whether it was '\u{63}'.
1163
1164
#[ unstable( feature = "proc_macro_span" , issue = "54725" ) ]
1164
1165
pub fn subspan < R : RangeBounds < usize > > ( & self , range : R ) -> Option < Span > {
1165
- // HACK(eddyb) something akin to `Option::cloned`, but for `Bound<&T>`.
1166
- fn cloned_bound < T : Clone > ( bound : Bound < & T > ) -> Bound < T > {
1167
- match bound {
1168
- Bound :: Included ( x) => Bound :: Included ( x. clone ( ) ) ,
1169
- Bound :: Excluded ( x) => Bound :: Excluded ( x. clone ( ) ) ,
1170
- Bound :: Unbounded => Bound :: Unbounded ,
1171
- }
1172
- }
1173
-
1174
- self . 0 . subspan ( cloned_bound ( range. start_bound ( ) ) , cloned_bound ( range. end_bound ( ) ) ) . map ( Span )
1166
+ self . 0 . subspan ( range. start_bound ( ) . cloned ( ) , range. end_bound ( ) . cloned ( ) ) . map ( Span )
1175
1167
}
1176
1168
}
1177
1169
0 commit comments