File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
c2rust-transpile/src/c_ast Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -155,13 +155,17 @@ struct SrcLocInclude<'a> {
155155 include_path : & ' a [ SrcLoc ] ,
156156}
157157
158+ impl SrcLocInclude < ' _ > {
159+ fn cmp_iter < ' a > ( & ' a self ) -> impl Iterator < Item = SrcLoc > + ' a {
160+ // See docs on `Self` for why this is the right comparison.
161+ let Self { loc, include_path } = * self ;
162+ include_path. iter ( ) . copied ( ) . chain ( [ loc] )
163+ }
164+ }
165+
158166impl PartialOrd for SrcLocInclude < ' _ > {
159167 fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
160- let a = self ;
161- let b = other;
162- let a = a. include_path . iter ( ) . copied ( ) . chain ( [ a. loc ] ) ;
163- let b = b. include_path . iter ( ) . copied ( ) . chain ( [ b. loc ] ) ;
164- Some ( a. cmp ( b) )
168+ Some ( self . cmp_iter ( ) . cmp ( other. cmp_iter ( ) ) )
165169 }
166170}
167171
You can’t perform that action at this time.
0 commit comments