File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
clippy_lints/src/utils/ast_utils Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,28 @@ use rustc_ast::*;
4
4
use rustc_ast:: ptr:: P ;
5
5
use rustc_span:: symbol:: Ident ;
6
6
7
- pub type IdentIter < ' a > = Box < dyn Iterator < Item = Ident > + ' a > ;
7
+ pub struct IdentIterator < ' a > ( IdentIter < ' a > ) ;
8
8
9
- pub fn from_expr < ' expr > ( expr : & ' expr Expr ) -> IdentIter < ' expr > {
10
- Box :: new ( ExprIdentIter :: new ( expr) )
9
+ type IdentIter < ' a > = Box < dyn Iterator < Item = Ident > + ' a > ;
10
+
11
+ impl < ' expr > Iterator for IdentIterator < ' expr > {
12
+ type Item = Ident ;
13
+
14
+ fn next ( & mut self ) -> Option < Self :: Item > {
15
+ self . 0 . next ( )
16
+ }
11
17
}
12
18
13
- pub fn from_ty < ' ty > ( ty : & ' ty Ty ) -> IdentIter < ' ty > {
14
- Box :: new ( TyIdentIter :: new ( ty) )
19
+ impl < ' expr > From < & ' expr Expr > for IdentIterator < ' expr > {
20
+ fn from ( expr : & ' expr Expr ) -> Self {
21
+ IdentIterator ( Box :: new ( ExprIdentIter :: new ( expr) ) )
22
+ }
23
+ }
24
+
25
+ impl < ' ty > From < & ' ty Ty > for IdentIterator < ' ty > {
26
+ fn from ( ty : & ' ty Ty ) -> Self {
27
+ IdentIterator ( Box :: new ( TyIdentIter :: new ( ty) ) )
28
+ }
15
29
}
16
30
17
31
struct ExprIdentIter < ' expr > {
You can’t perform that action at this time.
0 commit comments