Janitor: Optimize usage of is_dir/is_file

As suggested in https://github.com/slint-ui/slint/issues/4219

Closes #4219
This commit is contained in:
Olivier Goffart 2023-12-27 10:18:24 +01:00
parent 2a56542527
commit 5aa6b424e3
6 changed files with 16 additions and 14 deletions

View file

@ -36,8 +36,8 @@ fn syntax_tests() -> std::io::Result<()> {
let mut test_entries = Vec::new();
for entry in std::fs::read_dir(format!("{}/tests/syntax", env!("CARGO_MANIFEST_DIR")))? {
let entry = entry?;
let path = entry.path();
if path.is_dir() {
if entry.file_type().map_or(false, |f| f.is_dir()) {
let path = entry.path();
for test_entry in path.read_dir()? {
let test_entry = test_entry?;
let path = test_entry.path();