Skip to content

Commit a909b81

Browse files
committed
Tidy no longer fails when there are no files or subdirectories in a test directory.
1 parent 2ac9f61 commit a909b81

7 files changed

+107
-9
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
3+
|
4+
LL | (|| { let bar = foo; bar.take() })();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0507`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
3+
|
4+
LL | (|| { let bar = foo; bar.take() })();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0507`.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning[E0507]: cannot move out of borrowed content
2+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
3+
|
4+
LL | (|| { let bar = foo; bar.take() })();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
6+
|
7+
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
8+
It represents potential unsoundness in your code.
9+
This warning will become a hard error in the future.
10+
11+
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
12+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
13+
|
14+
LL | (|| { let bar = foo; bar.take() })();
15+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
| |
17+
| cannot move out of `foo`, as it is immutable for the pattern guard
18+
| cannot move
19+
|
20+
= note: variables bound in patterns are immutable until the end of the pattern guard
21+
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
22+
It represents potential unsoundness in your code.
23+
This warning will become a hard error in the future.
24+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning[E0507]: cannot move out of borrowed content
2+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
3+
|
4+
LL | (|| { let bar = foo; bar.take() })();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
6+
|
7+
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
8+
It represents potential unsoundness in your code.
9+
This warning will become a hard error in the future.
10+
11+
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
12+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
13+
|
14+
LL | (|| { let bar = foo; bar.take() })();
15+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
| |
17+
| cannot move out of `foo`, as it is immutable for the pattern guard
18+
| cannot move
19+
|
20+
= note: variables bound in patterns are immutable until the end of the pattern guard
21+
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
22+
It represents potential unsoundness in your code.
23+
This warning will become a hard error in the future.
24+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: borrowed data cannot be stored outside of its closure
2+
--> $DIR/issue-45983.rs:36:27
3+
|
4+
LL | let x = None;
5+
| - borrowed data cannot be stored into here...
6+
LL | give_any(|y| x = Some(y));
7+
| --- ^ cannot be stored outside of its closure
8+
| |
9+
| ...because it cannot outlive this closure
10+
11+
error: aborting due to previous error
12+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: emplacement syntax is obsolete (for now, anyway)
2+
--> $DIR/bad.rs:19:5
3+
|
4+
LL | x <- y; //[bad]~ ERROR emplacement syntax is obsolete
5+
| ^^^^^^
6+
|
7+
= note: for more information, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>
8+
9+
error: emplacement syntax is obsolete (for now, anyway)
10+
--> $DIR/bad.rs:20:5
11+
|
12+
LL | in(foo) { bar }; //[bad]~ ERROR emplacement syntax is obsolete
13+
| ^^^^^^^^^^^^^^^
14+
|
15+
= note: for more information, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>
16+
17+
error: aborting due to 2 previous errors
18+

src/tools/tidy/src/lib.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,18 @@ fn walk_many(paths: &[&Path], skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn F
8989
}
9090

9191
fn walk(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) {
92-
for entry in t!(fs::read_dir(path), path) {
93-
let entry = t!(entry);
94-
let kind = t!(entry.file_type());
95-
let path = entry.path();
96-
if kind.is_dir() {
97-
if !skip(&path) {
98-
walk(&path, skip, f);
92+
if let Ok(dir) = fs::read_dir(path) {
93+
for entry in dir {
94+
let entry = t!(entry);
95+
let kind = t!(entry.file_type());
96+
let path = entry.path();
97+
if kind.is_dir() {
98+
if !skip(&path) {
99+
walk(&path, skip, f);
100+
}
101+
} else {
102+
f(&path);
99103
}
100-
} else {
101-
f(&path);
102104
}
103105
}
104106
}

0 commit comments

Comments
 (0)