Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b4a363e

Browse files
committedJun 26, 2025··
googletest: Replace deprecated empty() matcher with is_empty()
1 parent ea3708d commit b4a363e

File tree

18 files changed

+60
-60
lines changed

18 files changed

+60
-60
lines changed
 

‎src/tests/github_secret_scanning.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async fn github_secret_alert_revokes_token() {
152152
.load(&mut conn)
153153
.await
154154
);
155-
assert_that!(tokens, empty());
155+
assert_that!(tokens, is_empty());
156156

157157
let tokens: Vec<ApiToken> = assert_ok!(
158158
ApiToken::belonging_to(user.as_model())
@@ -216,7 +216,7 @@ async fn github_secret_alert_for_revoked_token() {
216216
.load(&mut conn)
217217
.await
218218
);
219-
assert_that!(tokens, empty());
219+
assert_that!(tokens, is_empty());
220220

221221
let tokens: Vec<ApiToken> = assert_ok!(
222222
ApiToken::belonging_to(user.as_model())

‎src/tests/krate/following.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async fn test_following() {
9191
assert_that!(user.search("").await.crates, len(eq(1)));
9292
// see https://github.com/jplatte/serde_html_form/issues/13
9393
assert_that!(user.search("following").await.crates, len(eq(1)));
94-
assert_that!(user.search("following=1").await.crates, empty());
94+
assert_that!(user.search("following=1").await.crates, is_empty());
9595

9696
// Unfollow the crate again and check that this call is also idempotent.
9797
unfollow(CRATE_NAME, &user).await;

‎src/tests/krate/publish/auth.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ async fn new_wrong_token() {
2828
let response = token.publish_crate(crate_to_publish).await;
2929
assert_snapshot!(response.status(), @"403 Forbidden");
3030
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"authentication failed"}]}"#);
31-
assert_that!(app.stored_files().await, empty());
32-
assert_that!(app.emails().await, empty());
31+
assert_that!(app.stored_files().await, is_empty());
32+
assert_that!(app.emails().await, is_empty());
3333
}
3434

3535
#[tokio::test(flavor = "multi_thread")]
@@ -51,8 +51,8 @@ async fn new_krate_wrong_user() {
5151
assert_snapshot!(response.status(), @"403 Forbidden");
5252
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"this crate exists but you don't seem to be an owner. If you believe this is a mistake, perhaps you need to accept an invitation to be an owner before publishing."}]}"#);
5353

54-
assert_that!(app.stored_files().await, empty());
55-
assert_that!(app.emails().await, empty());
54+
assert_that!(app.stored_files().await, is_empty());
55+
assert_that!(app.emails().await, is_empty());
5656
}
5757

5858
#[tokio::test(flavor = "multi_thread")]

‎src/tests/krate/publish/basics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async fn new_krate_duplicate_version() {
158158
assert_snapshot!(response.status(), @"400 Bad Request");
159159
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate version `1.0.0` is already uploaded"}]}"#);
160160

161-
assert_that!(app.stored_files().await, empty());
161+
assert_that!(app.stored_files().await, is_empty());
162162
}
163163

164164
#[tokio::test(flavor = "multi_thread")]

‎src/tests/krate/publish/categories.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ async fn too_many_categories() {
5454
.await;
5555
assert_snapshot!(response.status(), @"400 Bad Request");
5656
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"expected at most 5 categories per crate"}]}"#);
57-
assert_that!(app.stored_files().await, empty());
57+
assert_that!(app.stored_files().await, is_empty());
5858
}

‎src/tests/krate/publish/deleted_crates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async fn test_recently_deleted_crate_with_same_name() -> anyhow::Result<()> {
3232
let response = token.publish_crate(crate_to_publish).await;
3333
assert_snapshot!(response.status(), @"400 Bad Request");
3434
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A crate with the name `actix_web` was recently deleted. Reuse of this name will be available after 2099-12-25T12:34:56Z."}]}"#);
35-
assert_that!(app.stored_files().await, empty());
35+
assert_that!(app.stored_files().await, is_empty());
3636

3737
Ok(())
3838
}

‎src/tests/krate/publish/dependencies.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async fn invalid_dependency_name() {
1212
.await;
1313
assert_snapshot!(response.status(), @"400 Bad Request");
1414
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🦀` in dependency name: `🦀`, the first character must be an ASCII character"}]}"#);
15-
assert_that!(app.stored_files().await, empty());
15+
assert_that!(app.stored_files().await, is_empty());
1616
}
1717

1818
#[tokio::test(flavor = "multi_thread")]
@@ -52,7 +52,7 @@ async fn invalid_dependency_rename() {
5252
.await;
5353
assert_snapshot!(response.status(), @"400 Bad Request");
5454
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `💩` in dependency name: `💩`, the first character must be an ASCII character, or `_`"}]}"#);
55-
assert_that!(app.stored_files().await, empty());
55+
assert_that!(app.stored_files().await, is_empty());
5656
}
5757

5858
#[tokio::test(flavor = "multi_thread")]
@@ -73,7 +73,7 @@ async fn invalid_dependency_name_starts_with_digit() {
7373
.await;
7474
assert_snapshot!(response.status(), @"400 Bad Request");
7575
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"the name `1-foo` cannot be used as a dependency name, the name cannot start with a digit"}]}"#);
76-
assert_that!(app.stored_files().await, empty());
76+
assert_that!(app.stored_files().await, is_empty());
7777
}
7878

7979
#[tokio::test(flavor = "multi_thread")]
@@ -94,7 +94,7 @@ async fn invalid_dependency_name_contains_unicode_chars() {
9494
.await;
9595
assert_snapshot!(response.status(), @"400 Bad Request");
9696
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🦀` in dependency name: `foo-🦀-bar`, characters must be an ASCII alphanumeric characters, `-`, or `_`"}]}"#);
97-
assert_that!(app.stored_files().await, empty());
97+
assert_that!(app.stored_files().await, is_empty());
9898
}
9999

100100
#[tokio::test(flavor = "multi_thread")]
@@ -115,7 +115,7 @@ async fn invalid_too_long_dependency_name() {
115115
.await;
116116
assert_snapshot!(response.status(), @"400 Bad Request");
117117
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"the dependency name `fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff` is too long (max 64 characters)"}]}"#);
118-
assert_that!(app.stored_files().await, empty());
118+
assert_that!(app.stored_files().await, is_empty());
119119
}
120120

121121
#[tokio::test(flavor = "multi_thread")]
@@ -136,7 +136,7 @@ async fn empty_dependency_name() {
136136
.await;
137137
assert_snapshot!(response.status(), @"400 Bad Request");
138138
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"dependency name cannot be empty"}]}"#);
139-
assert_that!(app.stored_files().await, empty());
139+
assert_that!(app.stored_files().await, is_empty());
140140
}
141141

142142
#[tokio::test(flavor = "multi_thread")]
@@ -212,7 +212,7 @@ async fn new_krate_with_broken_dependency_requirement() {
212212
let response = token.publish_crate(crate_to_publish).await;
213213
assert_snapshot!(response.status(), @"400 Bad Request");
214214
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"\"broken\" is an invalid version requirement"}]}"#);
215-
assert_that!(app.stored_files().await, empty());
215+
assert_that!(app.stored_files().await, is_empty());
216216
}
217217

218218
#[tokio::test(flavor = "multi_thread")]
@@ -232,7 +232,7 @@ async fn reject_new_krate_with_non_exact_dependency() {
232232
let response = token.publish_crate(crate_to_publish).await;
233233
assert_snapshot!(response.status(), @"400 Bad Request");
234234
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"no known crate named `foo_dep`"}]}"#);
235-
assert_that!(app.stored_files().await, empty());
235+
assert_that!(app.stored_files().await, is_empty());
236236
}
237237

238238
#[tokio::test(flavor = "multi_thread")]
@@ -261,7 +261,7 @@ async fn reject_new_crate_with_alternative_registry_dependency() {
261261
let response = token.publish_crate(crate_to_publish).await;
262262
assert_snapshot!(response.status(), @"400 Bad Request");
263263
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Dependency `dep` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io."}]}"#);
264-
assert_that!(app.stored_files().await, empty());
264+
assert_that!(app.stored_files().await, is_empty());
265265
}
266266

267267
#[tokio::test(flavor = "multi_thread")]
@@ -281,7 +281,7 @@ async fn new_krate_with_wildcard_dependency() {
281281
let response = token.publish_crate(crate_to_publish).await;
282282
assert_snapshot!(response.status(), @"400 Bad Request");
283283
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"wildcard (`*`) dependency constraints are not allowed on crates.io. Crate with this problem: `foo_wild` See https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies for more information"}]}"#);
284-
assert_that!(app.stored_files().await, empty());
284+
assert_that!(app.stored_files().await, is_empty());
285285
}
286286

287287
#[tokio::test(flavor = "multi_thread")]
@@ -313,7 +313,7 @@ async fn new_krate_with_patch() {
313313
let response = token.publish_crate(crate_to_publish).await;
314314
assert_snapshot!(response.status(), @"400 Bad Request");
315315
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"failed to parse `Cargo.toml` manifest file\n\ncrates cannot be published with `[patch]` tables"}]}"#);
316-
assert_that!(app.stored_files().await, empty());
316+
assert_that!(app.stored_files().await, is_empty());
317317
}
318318

319319
#[tokio::test(flavor = "multi_thread")]
@@ -328,7 +328,7 @@ async fn new_krate_dependency_missing() {
328328
let response = token.publish_crate(crate_to_publish).await;
329329
assert_snapshot!(response.status(), @"400 Bad Request");
330330
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"no known crate named `bar_missing`"}]}"#);
331-
assert_that!(app.stored_files().await, empty());
331+
assert_that!(app.stored_files().await, is_empty());
332332
}
333333

334334
#[tokio::test(flavor = "multi_thread")]
@@ -369,7 +369,7 @@ async fn invalid_feature_name() {
369369
.await;
370370
assert_snapshot!(response.status(), @"400 Bad Request");
371371
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🍺` in feature `🍺`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#);
372-
assert_that!(app.stored_files().await, empty());
372+
assert_that!(app.stored_files().await, is_empty());
373373
}
374374

375375
#[tokio::test(flavor = "multi_thread")]

‎src/tests/krate/publish/emails.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ async fn new_krate_without_any_email_fails() {
1919
let response = token.publish_crate(crate_to_publish).await;
2020
assert_snapshot!(response.status(), @"400 Bad Request");
2121
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/settings/profile to set and verify your email address."}]}"#);
22-
assert_that!(app.stored_files().await, empty());
23-
assert_that!(app.emails().await, empty());
22+
assert_that!(app.stored_files().await, is_empty());
23+
assert_that!(app.emails().await, is_empty());
2424
}
2525

2626
#[tokio::test(flavor = "multi_thread")]
@@ -39,6 +39,6 @@ async fn new_krate_with_unverified_email_fails() {
3939
let response = token.publish_crate(crate_to_publish).await;
4040
assert_snapshot!(response.status(), @"400 Bad Request");
4141
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/settings/profile to set and verify your email address."}]}"#);
42-
assert_that!(app.stored_files().await, empty());
43-
assert_that!(app.emails().await, empty());
42+
assert_that!(app.stored_files().await, is_empty());
43+
assert_that!(app.emails().await, is_empty());
4444
}

‎src/tests/krate/publish/features.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async fn invalid_feature_name1() {
7272
let response = token.publish_crate(crate_to_publish).await;
7373
assert_snapshot!(response.status(), @"400 Bad Request");
7474
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `~` in feature `~foo`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#);
75-
assert_that!(app.stored_files().await, empty());
75+
assert_that!(app.stored_files().await, is_empty());
7676
}
7777

7878
#[tokio::test(flavor = "multi_thread")]
@@ -83,7 +83,7 @@ async fn invalid_feature_name2() {
8383
let response = token.publish_crate(crate_to_publish).await;
8484
assert_snapshot!(response.status(), @"400 Bad Request");
8585
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `!` in feature `!bar`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#);
86-
assert_that!(app.stored_files().await, empty());
86+
assert_that!(app.stored_files().await, is_empty());
8787
}
8888

8989
#[tokio::test(flavor = "multi_thread")]
@@ -114,7 +114,7 @@ async fn too_many_features() {
114114
let response = token.publish_crate(publish_builder).await;
115115
assert_snapshot!(response.status(), @"400 Bad Request");
116116
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 3 features, but your crate is declaring 5 features.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#);
117-
assert_that!(app.stored_files().await, empty());
117+
assert_that!(app.stored_files().await, is_empty());
118118
}
119119

120120
#[tokio::test(flavor = "multi_thread")]
@@ -142,7 +142,7 @@ async fn too_many_features_with_custom_limit() {
142142
let response = token.publish_crate(publish_builder).await;
143143
assert_snapshot!(response.status(), @"400 Bad Request");
144144
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 4 features, but your crate is declaring 5 features.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#);
145-
assert_that!(app.stored_files().await, empty());
145+
assert_that!(app.stored_files().await, is_empty());
146146

147147
let publish_builder = PublishBuilder::new("foo", "1.0.0")
148148
.feature("one", &[])
@@ -174,7 +174,7 @@ async fn too_many_enabled_features() {
174174
let response = token.publish_crate(publish_builder).await;
175175
assert_snapshot!(response.status(), @"400 Bad Request");
176176
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 3 features or dependencies that another feature can enable, but the \"default\" feature of your crate is enabling 5 features or dependencies.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#);
177-
assert_that!(app.stored_files().await, empty());
177+
assert_that!(app.stored_files().await, is_empty());
178178
}
179179

180180
#[tokio::test(flavor = "multi_thread")]
@@ -198,7 +198,7 @@ async fn too_many_enabled_features_with_custom_limit() {
198198
let response = token.publish_crate(publish_builder).await;
199199
assert_snapshot!(response.status(), @"400 Bad Request");
200200
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 4 features or dependencies that another feature can enable, but the \"default\" feature of your crate is enabling 5 features or dependencies.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#);
201-
assert_that!(app.stored_files().await, empty());
201+
assert_that!(app.stored_files().await, is_empty());
202202

203203
let publish_builder =
204204
PublishBuilder::new("foo", "1.0.0").feature("default", &["one", "two", "three", "four"]);

‎src/tests/krate/publish/keywords.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ async fn too_many_keywords() {
5454
.await;
5555
assert_snapshot!(response.status(), @"400 Bad Request");
5656
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"expected at most 5 keywords per crate"}]}"#);
57-
assert_that!(app.stored_files().await, empty());
57+
assert_that!(app.stored_files().await, is_empty());
5858
}

‎src/tests/krate/publish/max_size.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async fn tarball_bigger_than_max_upload_size() {
9191
let response = token.publish_crate(body).await;
9292
assert_snapshot!(response.status(), @"413 Payload Too Large");
9393
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"max upload size is: 5242880"}]}"#);
94-
assert_that!(app.stored_files().await, empty());
94+
assert_that!(app.stored_files().await, is_empty());
9595
}
9696

9797
#[tokio::test(flavor = "multi_thread")]
@@ -110,7 +110,7 @@ async fn new_krate_gzip_bomb() {
110110
let response = token.publish_crate(crate_to_publish).await;
111111
assert_snapshot!(response.status(), @"400 Bad Request");
112112
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"uploaded tarball is malformed or too large when decompressed"}]}"#);
113-
assert_that!(app.stored_files().await, empty());
113+
assert_that!(app.stored_files().await, is_empty());
114114
}
115115

116116
#[tokio::test(flavor = "multi_thread")]
@@ -129,7 +129,7 @@ async fn new_krate_too_big() {
129129
let response = user.publish_crate(builder).await;
130130
assert_snapshot!(response.status(), @"400 Bad Request");
131131
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"uploaded tarball is malformed or too large when decompressed"}]}"#);
132-
assert_that!(app.stored_files().await, empty());
132+
assert_that!(app.stored_files().await, is_empty());
133133
}
134134

135135
#[tokio::test(flavor = "multi_thread")]

‎src/tests/krate/publish/similar_names.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async fn new_crate_similar_name() {
1717
let response = token.publish_crate(crate_to_publish).await;
1818
assert_snapshot!(response.status(), @"400 Bad Request");
1919
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate was previously named `Foo_similar`"}]}"#);
20-
assert_that!(app.stored_files().await, empty());
20+
assert_that!(app.stored_files().await, is_empty());
2121
}
2222

2323
#[tokio::test(flavor = "multi_thread")]
@@ -34,7 +34,7 @@ async fn new_crate_similar_name_hyphen() {
3434
let response = token.publish_crate(crate_to_publish).await;
3535
assert_snapshot!(response.status(), @"400 Bad Request");
3636
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate was previously named `foo_bar_hyphen`"}]}"#);
37-
assert_that!(app.stored_files().await, empty());
37+
assert_that!(app.stored_files().await, is_empty());
3838
}
3939

4040
#[tokio::test(flavor = "multi_thread")]
@@ -51,5 +51,5 @@ async fn new_crate_similar_name_underscore() {
5151
let response = token.publish_crate(crate_to_publish).await;
5252
assert_snapshot!(response.status(), @"400 Bad Request");
5353
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate was previously named `foo-bar-underscore`"}]}"#);
54-
assert_that!(app.stored_files().await, empty());
54+
assert_that!(app.stored_files().await, is_empty());
5555
}

‎src/tests/krate/publish/tarball.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async fn new_krate_wrong_files() {
1616
let response = user.publish_crate(builder).await;
1717
assert_snapshot!(response.status(), @"400 Bad Request");
1818
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid path found: bar-1.0.0/a"}]}"#);
19-
assert_that!(app.stored_files().await, empty());
19+
assert_that!(app.stored_files().await, is_empty());
2020
}
2121

2222
#[tokio::test(flavor = "multi_thread")]
@@ -43,7 +43,7 @@ async fn new_krate_tarball_with_hard_links() {
4343
let response = token.publish_crate(body).await;
4444
assert_snapshot!(response.status(), @"400 Bad Request");
4545
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"unexpected symlink or hard link found: foo-1.1.0/bar"}]}"#);
46-
assert_that!(app.stored_files().await, empty());
46+
assert_that!(app.stored_files().await, is_empty());
4747
}
4848

4949
#[tokio::test(flavor = "multi_thread")]
@@ -53,7 +53,7 @@ async fn empty_body() {
5353
let response = user.publish_crate(&[] as &[u8]).await;
5454
assert_snapshot!(response.status(), @"400 Bad Request");
5555
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid metadata length"}]}"#);
56-
assert_that!(app.stored_files().await, empty());
56+
assert_that!(app.stored_files().await, is_empty());
5757
}
5858

5959
#[tokio::test(flavor = "multi_thread")]
@@ -63,7 +63,7 @@ async fn json_len_truncated() {
6363
let response = token.publish_crate(&[0u8, 0] as &[u8]).await;
6464
assert_snapshot!(response.status(), @"400 Bad Request");
6565
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid metadata length"}]}"#);
66-
assert_that!(app.stored_files().await, empty());
66+
assert_that!(app.stored_files().await, is_empty());
6767
}
6868

6969
#[tokio::test(flavor = "multi_thread")]
@@ -73,7 +73,7 @@ async fn json_bytes_truncated() {
7373
let response = token.publish_crate(&[100u8, 0, 0, 0, 0] as &[u8]).await;
7474
assert_snapshot!(response.status(), @"400 Bad Request");
7575
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid metadata length for remaining payload: 100"}]}"#);
76-
assert_that!(app.stored_files().await, empty());
76+
assert_that!(app.stored_files().await, is_empty());
7777
}
7878

7979
#[tokio::test(flavor = "multi_thread")]
@@ -92,7 +92,7 @@ async fn tarball_len_truncated() {
9292

9393
assert_snapshot!(response.status(), @"400 Bad Request");
9494
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid tarball length"}]}"#);
95-
assert_that!(app.stored_files().await, empty());
95+
assert_that!(app.stored_files().await, is_empty());
9696
}
9797

9898
#[tokio::test(flavor = "multi_thread")]
@@ -110,5 +110,5 @@ async fn tarball_bytes_truncated() {
110110
let response = token.publish_crate(bytes.freeze()).await;
111111
assert_snapshot!(response.status(), @"400 Bad Request");
112112
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid tarball length for remaining payload: 100"}]}"#);
113-
assert_that!(app.stored_files().await, empty());
113+
assert_that!(app.stored_files().await, is_empty());
114114
}

‎src/tests/krate/publish/validation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async fn empty_json() {
1515
let response = token.publish_crate(body).await;
1616
assert_snapshot!(response.status(), @"400 Bad Request");
1717
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid upload request: missing field `name` at line 1 column 2"}]}"#);
18-
assert_that!(app.stored_files().await, empty());
18+
assert_that!(app.stored_files().await, is_empty());
1919
}
2020

2121
#[tokio::test(flavor = "multi_thread")]
@@ -41,7 +41,7 @@ async fn invalid_names() {
4141
bad_name("compiler_rt", &token).await;
4242
bad_name("coMpiLer_Rt", &token).await;
4343

44-
assert_that!(app.stored_files().await, empty());
44+
assert_that!(app.stored_files().await, is_empty());
4545
}
4646

4747
#[tokio::test(flavor = "multi_thread")]
@@ -56,7 +56,7 @@ async fn invalid_version() {
5656
let response = token.publish_crate(body).await;
5757
assert_snapshot!(response.status(), @"400 Bad Request");
5858
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"\"broken\" is an invalid semver version"}]}"#);
59-
assert_that!(app.stored_files().await, empty());
59+
assert_that!(app.stored_files().await, is_empty());
6060
}
6161

6262
#[tokio::test(flavor = "multi_thread")]
@@ -83,7 +83,7 @@ async fn license_and_description_required() {
8383
let response = token.publish_crate(crate_to_publish).await;
8484
assert_snapshot!(response.status(), @"400 Bad Request");
8585
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"missing or empty metadata fields: description. Please see https://doc.rust-lang.org/cargo/reference/manifest.html for more information on configuring these fields"}]}"#);
86-
assert_that!(app.stored_files().await, empty());
86+
assert_that!(app.stored_files().await, is_empty());
8787
}
8888

8989
#[tokio::test(flavor = "multi_thread")]
@@ -97,7 +97,7 @@ async fn long_description() {
9797
assert_snapshot!(response.status(), @"400 Bad Request");
9898
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"The `description` is too long. A maximum of 1000 characters are currently allowed."}]}"#);
9999

100-
assert_that!(app.stored_files().await, empty());
100+
assert_that!(app.stored_files().await, is_empty());
101101
}
102102

103103
#[tokio::test(flavor = "multi_thread")]
@@ -109,7 +109,7 @@ async fn invalid_license() {
109109
.await;
110110
assert_snapshot!(response.status(), @"400 Bad Request");
111111
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"unknown or invalid license expression; see http://opensource.org/licenses for options, and http://spdx.org/licenses/ for their identifiers\nNote: If you have a non-standard license that is not listed by SPDX, use the license-file field to specify the path to a file containing the text of the license.\nSee https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields for more information.\nMIT AND foobar\n ^^^^^^ unknown term"}]}"#);
112-
assert_that!(app.stored_files().await, empty());
112+
assert_that!(app.stored_files().await, is_empty());
113113
}
114114

115115
#[tokio::test(flavor = "multi_thread")]
@@ -123,5 +123,5 @@ async fn invalid_urls() {
123123
.await;
124124
assert_snapshot!(response.status(), @"400 Bad Request");
125125
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"URL for field `documentation` must begin with http:// or https:// (url: javascript:alert('boom'))"}]}"#);
126-
assert_that!(app.stored_files().await, empty());
126+
assert_that!(app.stored_files().await, is_empty());
127127
}

‎src/tests/routes/crates/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ async fn seek_based_pagination() -> anyhow::Result<()> {
10731073
assert_eq!(resp.meta.total, 3);
10741074
assert!(default_versions_iter(&resp.crates).all(Option::is_some));
10751075
} else {
1076-
assert_that!(resp.crates, empty());
1076+
assert_that!(resp.crates, is_empty());
10771077
assert_eq!(resp.meta.total, 0);
10781078
}
10791079

@@ -1269,7 +1269,7 @@ async fn page_with_seek<U: RequestHelper>(
12691269
assert_ne!(resp.meta.total, 0);
12701270
assert!(default_versions_iter(&resp.crates).all(Option::is_some));
12711271
} else {
1272-
assert_that!(resp.crates, empty());
1272+
assert_that!(resp.crates, is_empty());
12731273
assert_eq!(resp.meta.total, 0);
12741274
}
12751275
results.push(resp);

‎src/tests/routes/crates/versions/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ async fn page_with_seek<U: RequestHelper>(anon: &U, url: &str) -> (Vec<VersionLi
464464
url = Some(format!("{url_without_query}{}", new_url));
465465
assert_ne!(resp.meta.total, 0)
466466
} else {
467-
assert_that!(resp.versions, empty());
467+
assert_that!(resp.versions, is_empty());
468468
assert_eq!(resp.meta.total, 0)
469469
}
470470
results.push(resp);

‎src/tests/routes/me/updates.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async fn following() {
5353
.await;
5454

5555
let r: R = user.get("/api/v1/me/updates").await.good();
56-
assert_that!(r.versions, empty());
56+
assert_that!(r.versions, is_empty());
5757
assert!(!r.meta.more);
5858

5959
user.put::<OkBool>("/api/v1/crates/foo_fighters/follow", b"" as &[u8])
@@ -96,7 +96,7 @@ async fn following() {
9696
.get_with_query("/api/v1/me/updates", "page=2&per_page=1")
9797
.await
9898
.good();
99-
assert_that!(r.versions, empty());
99+
assert_that!(r.versions, is_empty());
100100
assert!(!r.meta.more);
101101

102102
let response = user

‎src/typosquat/checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ mod tests {
118118
{
119119
let name = package.name.clone();
120120
let squats = harness.check_package(&name, Box::new(package))?;
121-
assert_that!(squats, empty());
121+
assert_that!(squats, is_empty());
122122
}
123123

124124
// Now try some packages that should be.

0 commit comments

Comments
 (0)
Please sign in to comment.