Increase code readability

This commit is contained in:
aodenis 2025-02-22 00:26:26 +01:00
parent 3fbde6c4d8
commit 0576a2fe9f

View File

@ -237,7 +237,7 @@ impl Watcher {
/// Whether a watch event is relevant for compilation.
fn is_event_relevant(&self, event: &notify::Event) -> bool {
let type_relevant = match &event.kind {
let kind_relevant = match &event.kind {
notify::EventKind::Any => true,
notify::EventKind::Access(_) => false,
notify::EventKind::Create(_) => true,
@ -252,12 +252,20 @@ impl Watcher {
notify::EventKind::Other => false,
};
if !kind_relevant {
return false;
}
// Never recompile because the output file changed.
type_relevant
&& !event
if event
.paths
.iter()
.all(|path| is_same_file(path, &self.output).unwrap_or(false))
{
return false;
}
true
}
}