Skip to content

Commit

Permalink
fixes paths thing
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjitjhala committed Dec 4, 2024
1 parent 8499fe4 commit 80fba97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions crates/flux-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn is_cache_enabled() -> bool {
}

pub fn is_checked_file(file: &str) -> bool {
CONFIG.check_files.is_empty() || CONFIG.check_files.contains(file)
CONFIG.check_files.is_checked_file(file)
}

pub fn cache_path() -> PathBuf {
Expand Down Expand Up @@ -94,16 +94,14 @@ struct Config {

#[derive(Default)]
struct Paths {
paths: Vec<PathBuf>,
paths: Option<Vec<PathBuf>>,
}

impl Paths {
fn is_empty(&self) -> bool {
self.paths.is_empty()
}

fn contains(&self, path: &str) -> bool {
self.paths.iter().any(|p| p.to_str().unwrap() == path)
fn is_checked_file(&self, file: &str) -> bool {
self.paths
.as_ref()
.map_or(true, |p| p.iter().any(|p| p.to_str().unwrap() == file))
}
}

Expand All @@ -112,11 +110,15 @@ impl<'de> Deserialize<'de> for Paths {
where
D: serde::Deserializer<'de>,
{
let paths = String::deserialize(deserializer)?
.split(',')
.into_iter()
let paths: Vec<PathBuf> = String::deserialize(deserializer)?
.split(",")
.map(str::trim)
.filter(|s| !s.is_empty())
.map(PathBuf::from)
.collect();

let paths = if paths.is_empty() { None } else { Some(paths) };

Ok(Paths { paths })
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/flux-driver/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<'genv, 'tcx> CrateChecker<'genv, 'tcx> {
return config::is_checked_file(&file);
}
}
return true;
true
}

fn check_def_catching_bugs(&mut self, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
Expand Down

0 comments on commit 80fba97

Please sign in to comment.