mirror of
https://github.com/typst/typst
synced 2025-08-12 06:07:54 +08:00
Increase code readability
This commit is contained in:
parent
3fbde6c4d8
commit
0576a2fe9f
@ -237,7 +237,7 @@ impl Watcher {
|
||||
|
||||
/// Whether a watch event is relevant for compilation.
|
||||
fn is_event_relevant(&self, event: ¬ify::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
|
||||
.paths
|
||||
.iter()
|
||||
.all(|path| is_same_file(path, &self.output).unwrap_or(false))
|
||||
if event
|
||||
.paths
|
||||
.iter()
|
||||
.all(|path| is_same_file(path, &self.output).unwrap_or(false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user