Skip to content

Commit c4ba6ca

Browse files
committed
Remove unnecessary clones
1 parent e81f8dc commit c4ba6ca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/formatters/tool.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ pub fn glob_to_path(
123123
for include in includes {
124124
// Remove trailing `/` as we add one explicitly in the override
125125
let include = include.trim_end_matches('/');
126-
for extension in extensions.clone().into_iter() {
126+
for extension in extensions.into_iter() {
127127
overrides_builder.add(&format!("{}/**/{}", include, extension))?;
128128
}
129129
}
130130
} else {
131-
for extension in extensions.clone().into_iter() {
131+
for extension in extensions.into_iter() {
132132
overrides_builder.add(&extension)?;
133133
}
134134
}
@@ -255,14 +255,14 @@ pub enum FileExtensions {
255255
MultipleFile(Vec<String>),
256256
}
257257

258-
impl IntoIterator for FileExtensions {
259-
type Item = String;
260-
type IntoIter = either::Either<std::iter::Once<String>, std::vec::IntoIter<String>>;
258+
impl<'a> IntoIterator for &'a FileExtensions {
259+
type Item = &'a String;
260+
type IntoIter = either::Either<std::iter::Once<&'a String>, std::slice::Iter<'a, String>>;
261261

262262
fn into_iter(self) -> Self::IntoIter {
263263
match self {
264264
FileExtensions::SingleFile(glob) => either::Either::Left(std::iter::once(glob)),
265-
FileExtensions::MultipleFile(globs) => either::Either::Right(globs.into_iter()),
265+
FileExtensions::MultipleFile(globs) => either::Either::Right(globs.iter()),
266266
}
267267
}
268268
}

0 commit comments

Comments
 (0)