Skip to content

Commit 47b5d95

Browse files
committed
Remove FileMatch.
It's returned from `FileSearch::search` but it's only used to print some debug info.
1 parent f916f3a commit 47b5d95

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

compiler/rustc_metadata/src/locator.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ use rustc_data_structures::sync::MetadataRef;
223223
use rustc_errors::{struct_span_err, FatalError};
224224
use rustc_session::config::{self, CrateType};
225225
use rustc_session::cstore::{CrateSource, MetadataLoader};
226-
use rustc_session::filesearch::{FileDoesntMatch, FileMatches, FileSearch};
226+
use rustc_session::filesearch::FileSearch;
227227
use rustc_session::search_paths::PathKind;
228228
use rustc_session::utils::CanonicalizedPath;
229229
use rustc_session::Session;
@@ -396,7 +396,7 @@ impl<'a> CrateLocator<'a> {
396396
// The goal of this step is to look at as little metadata as possible.
397397
self.filesearch.search(|spf, kind| {
398398
let file = match &spf.file_name_str {
399-
None => return FileDoesntMatch,
399+
None => return,
400400
Some(file) => file,
401401
};
402402
let (hash, found_kind) = if file.starts_with(&rlib_prefix) && file.ends_with(".rlib") {
@@ -415,23 +415,22 @@ impl<'a> CrateLocator<'a> {
415415
staticlibs
416416
.push(CrateMismatch { path: spf.path.clone(), got: "static".to_string() });
417417
}
418-
return FileDoesntMatch;
418+
return;
419419
};
420420

421421
info!("lib candidate: {}", spf.path.display());
422422

423423
let (rlibs, rmetas, dylibs) = candidates.entry(hash.to_string()).or_default();
424424
let path = fs::canonicalize(&spf.path).unwrap_or_else(|_| spf.path.clone());
425425
if seen_paths.contains(&path) {
426-
return FileDoesntMatch;
426+
return;
427427
};
428428
seen_paths.insert(path.clone());
429429
match found_kind {
430430
CrateFlavor::Rlib => rlibs.insert(path, kind),
431431
CrateFlavor::Rmeta => rmetas.insert(path, kind),
432432
CrateFlavor::Dylib => dylibs.insert(path, kind),
433433
};
434-
FileMatches
435434
});
436435
self.crate_rejections.via_kind.extend(staticlibs);
437436

compiler/rustc_session/src/filesearch.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! A module for searching for libraries
22
3-
pub use self::FileMatch::*;
4-
53
use std::env;
64
use std::fs;
75
use std::iter::FromIterator;
@@ -45,21 +43,13 @@ impl<'a> FileSearch<'a> {
4543

4644
pub fn search<F>(&self, mut pick: F)
4745
where
48-
F: FnMut(&SearchPathFile, PathKind) -> FileMatch,
46+
F: FnMut(&SearchPathFile, PathKind),
4947
{
5048
for search_path in self.search_paths() {
5149
debug!("searching {}", search_path.dir.display());
5250
for spf in search_path.files.iter() {
5351
debug!("testing {}", spf.path.display());
54-
let maybe_picked = pick(spf, search_path.kind);
55-
match maybe_picked {
56-
FileMatches => {
57-
debug!("picked {}", spf.path.display());
58-
}
59-
FileDoesntMatch => {
60-
debug!("rejected {}", spf.path.display());
61-
}
62-
}
52+
pick(spf, search_path.kind);
6353
}
6454
}
6555
}

0 commit comments

Comments
 (0)