Skip to content

Commit 09ff194

Browse files
committed
Remove unnecessary mutability
1 parent 6066463 commit 09ff194

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cargo/sources/path.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl<'cfg> PathSource<'cfg> {
150150
}
151151
};
152152

153-
let mut filter = |path: &Path, is_dir: bool| {
153+
let filter = |path: &Path, is_dir: bool| {
154154
let relative_path = match path.strip_prefix(root) {
155155
Ok(p) => p,
156156
Err(_) => return false,
@@ -169,10 +169,10 @@ impl<'cfg> PathSource<'cfg> {
169169
// Attempt Git-prepopulate only if no `include` (see rust-lang/cargo#4135).
170170
if no_include_option {
171171
if let Some(repo) = git_repo {
172-
return self.list_files_git(pkg, &repo, &mut filter);
172+
return self.list_files_git(pkg, &repo, &filter);
173173
}
174174
}
175-
self.list_files_walk(pkg, &mut filter)
175+
self.list_files_walk(pkg, &filter)
176176
}
177177

178178
/// Returns `Some(git2::Repository)` if found sibling `Cargo.toml` and `.git`
@@ -222,7 +222,7 @@ impl<'cfg> PathSource<'cfg> {
222222
&self,
223223
pkg: &Package,
224224
repo: &git2::Repository,
225-
filter: &mut dyn FnMut(&Path, bool) -> bool,
225+
filter: &dyn Fn(&Path, bool) -> bool,
226226
) -> CargoResult<Vec<PathBuf>> {
227227
warn!("list_files_git {}", pkg.package_id());
228228
let index = repo.index()?;
@@ -376,7 +376,7 @@ impl<'cfg> PathSource<'cfg> {
376376
fn list_files_walk(
377377
&self,
378378
pkg: &Package,
379-
filter: &mut dyn FnMut(&Path, bool) -> bool,
379+
filter: &dyn Fn(&Path, bool) -> bool,
380380
) -> CargoResult<Vec<PathBuf>> {
381381
let mut ret = Vec::new();
382382
self.walk(pkg.root(), &mut ret, true, filter)?;
@@ -388,7 +388,7 @@ impl<'cfg> PathSource<'cfg> {
388388
path: &Path,
389389
ret: &mut Vec<PathBuf>,
390390
is_root: bool,
391-
filter: &mut dyn FnMut(&Path, bool) -> bool,
391+
filter: &dyn Fn(&Path, bool) -> bool,
392392
) -> CargoResult<()> {
393393
let walkdir = WalkDir::new(path)
394394
.follow_links(true)

0 commit comments

Comments
 (0)