File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -103,16 +103,15 @@ impl Instrumentor {
103
103
version : & str ,
104
104
file_path : & PathBuf ,
105
105
) -> InstrumentationVisitor {
106
- let mut instrumentations = self
106
+ let instrumentations = self
107
107
. instrumentations
108
108
. iter ( )
109
109
. filter ( |instr| instr. matches ( module_name, version, file_path) )
110
110
. cloned ( )
111
- . collect :: < Vec < _ > > ( ) ;
112
-
113
- for instr in & mut instrumentations {
114
- instr. set_module_version ( version) ;
115
- }
111
+ . map ( |mut i| {
112
+ i. set_module_version ( version) ;
113
+ i
114
+ } ) ;
116
115
117
116
InstrumentationVisitor :: new ( instrumentations, & self . dc_module )
118
117
}
@@ -125,10 +124,12 @@ pub struct InstrumentationVisitor {
125
124
}
126
125
127
126
impl InstrumentationVisitor {
128
- fn new ( instrumentations : Vec < Instrumentation > , dc_module : & str ) -> Self
129
- where {
127
+ fn new < I > ( instrumentations : I , dc_module : & str ) -> Self
128
+ where
129
+ I : Iterator < Item = Instrumentation > ,
130
+ {
130
131
Self {
131
- instrumentations,
132
+ instrumentations : instrumentations . collect ( ) ,
132
133
dc_module : dc_module. to_string ( ) ,
133
134
}
134
135
}
You can’t perform that action at this time.
0 commit comments