File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,7 @@ fn tee(options: &Options) -> Result<()> {
148
148
}
149
149
let mut writers: Vec < NamedWriter > = options
150
150
. files
151
- . clone ( )
152
- . into_iter ( )
151
+ . iter ( )
153
152
. filter_map ( |file| open ( file, options. append , options. output_error . as_ref ( ) ) )
154
153
. collect :: < Result < Vec < NamedWriter > > > ( ) ?;
155
154
let had_open_errors = writers. len ( ) != options. files . len ( ) ;
@@ -188,11 +187,11 @@ fn tee(options: &Options) -> Result<()> {
188
187
/// If that error should lead to program termination, this function returns Some(Err()),
189
188
/// otherwise it returns None.
190
189
fn open (
191
- name : String ,
190
+ name : & str ,
192
191
append : bool ,
193
192
output_error : Option < & OutputErrorMode > ,
194
193
) -> Option < Result < NamedWriter > > {
195
- let path = PathBuf :: from ( name. clone ( ) ) ;
194
+ let path = PathBuf :: from ( name) ;
196
195
let mut options = OpenOptions :: new ( ) ;
197
196
let mode = if append {
198
197
options. append ( true )
@@ -202,7 +201,7 @@ fn open(
202
201
match mode. write ( true ) . create ( true ) . open ( path. as_path ( ) ) {
203
202
Ok ( file) => Some ( Ok ( NamedWriter {
204
203
inner : Box :: new ( file) ,
205
- name,
204
+ name : name . to_owned ( ) ,
206
205
} ) ) ,
207
206
Err ( f) => {
208
207
show_error ! ( "{}: {}" , name. maybe_quote( ) , f) ;
You can’t perform that action at this time.
0 commit comments