Skip to content

Commit cb38b9c

Browse files
ndmitchellfacebook-github-bot
authored andcommitted
Delete the FileList trait
Summary: We only ever use one instance, so just use a concrete type. Reviewed By: yangdanny97 Differential Revision: D73776791 fbshipit-source-id: 9d261298011f9a7fc942723dd41a2dc59c50a068
1 parent 1d3e91b commit cb38b9c

File tree

5 files changed

+5
-33
lines changed

5 files changed

+5
-33
lines changed

pyrefly/lib/commands/check.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::util::display;
5353
use crate::util::display::number_thousands;
5454
use crate::util::forgetter::Forgetter;
5555
use crate::util::fs_anyhow;
56-
use crate::util::listing::FileList;
56+
use crate::util::globs::FilteredGlobs;
5757
use crate::util::memory::MemoryUsageTrace;
5858
use crate::util::prelude::SliceExt;
5959
use crate::util::watcher::CategorizedEvents;
@@ -262,7 +262,7 @@ async fn get_watcher_events(watcher: &mut impl Watcher) -> anyhow::Result<Catego
262262
impl Args {
263263
pub fn run_once(
264264
self,
265-
files_to_check: impl FileList,
265+
files_to_check: FilteredGlobs,
266266
config_finder: ConfigFinder,
267267
allow_forget: bool,
268268
) -> anyhow::Result<CommandExitStatus> {
@@ -286,7 +286,7 @@ impl Args {
286286
pub async fn run_watch(
287287
self,
288288
mut watcher: impl Watcher,
289-
files_to_check: impl FileList,
289+
files_to_check: FilteredGlobs,
290290
config_finder: ConfigFinder,
291291
) -> anyhow::Result<()> {
292292
// TODO: We currently make 1 unrealistic assumptions, which should be fixed in the future:

pyrefly/lib/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ pub mod library {
7777
pub use crate::util::args::clap_env;
7878
pub use crate::util::args::get_args_expanded;
7979
pub use crate::util::globs;
80-
pub use crate::util::listing::FileList;
8180
pub use crate::util::notify_watcher::NotifyWatcher;
8281
pub use crate::util::thread_pool::init_thread_pool;
8382
pub use crate::util::trace::init_tracing;

pyrefly/lib/util/globs.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use starlark_map::small_set::SmallSet;
2828
use tracing::debug;
2929

3030
use crate::util::fs_anyhow;
31-
use crate::util::listing::FileList;
3231
use crate::util::prelude::SliceExt;
3332
use crate::util::prelude::VecExt;
3433

@@ -348,10 +347,8 @@ impl FilteredGlobs {
348347
pub fn roots(&self) -> Vec<PathBuf> {
349348
self.includes.roots()
350349
}
351-
}
352350

353-
impl FileList for FilteredGlobs {
354-
fn files(&self) -> anyhow::Result<Vec<PathBuf>> {
351+
pub fn files(&self) -> anyhow::Result<Vec<PathBuf>> {
355352
let mut result = Vec::new();
356353
for file in self.includes.files()? {
357354
if !self.excludes.matches(&file)? {
@@ -368,7 +365,7 @@ impl FileList for FilteredGlobs {
368365
Ok(result)
369366
}
370367

371-
fn covers(&self, path: &Path) -> bool {
368+
pub fn covers(&self, path: &Path) -> bool {
372369
self.includes.covers(path) && !self.excludes.covers(path)
373370
}
374371
}

pyrefly/lib/util/listing.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

pyrefly/lib/util/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub mod forgetter;
1616
pub mod fs_anyhow;
1717
pub mod gas;
1818
pub mod globs;
19-
pub mod listing;
2019
pub mod lock;
2120
pub mod locked_map;
2221
pub mod memory;

0 commit comments

Comments
 (0)