3131#![ feature( restricted_std) ]
3232#![ feature( rustc_attrs) ]
3333#![ feature( min_specialization) ]
34+ #![ feature( bound_cloned) ]
3435#![ recursion_limit = "256" ]
3536
3637#[ unstable( feature = "proc_macro_internals" , issue = "27812" ) ]
@@ -43,7 +44,7 @@ mod diagnostic;
4344pub use diagnostic:: { Diagnostic , Level , MultiSpan } ;
4445
4546use std:: cmp:: Ordering ;
46- use std:: ops:: { Bound , RangeBounds } ;
47+ use std:: ops:: RangeBounds ;
4748use std:: path:: PathBuf ;
4849use std:: str:: FromStr ;
4950use std:: { error, fmt, iter, mem} ;
@@ -1162,16 +1163,7 @@ impl Literal {
11621163 // was 'c' or whether it was '\u{63}'.
11631164 #[ unstable( feature = "proc_macro_span" , issue = "54725" ) ]
11641165 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 )
11751167 }
11761168}
11771169
0 commit comments