Skip to content

Commit 144a377

Browse files
authored
chore: fix clippy warnings on Rust 1.88 (#355)
Also, use `ignore = ""` syntax for miri-ignored tests.
1 parent 030bbd2 commit 144a377

File tree

14 files changed

+170
-59
lines changed

14 files changed

+170
-59
lines changed

cot-cli/src/utils.rs

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,10 @@ mod tests {
342342
use super::*;
343343

344344
#[test]
345-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
346-
#[cfg_attr(miri, ignore)]
345+
#[cfg_attr(
346+
miri,
347+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
348+
)]
347349
fn find_cargo_toml() {
348350
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
349351
test_utils::make_package(temp_dir.path()).unwrap();
@@ -354,8 +356,10 @@ mod tests {
354356
}
355357

356358
#[test]
357-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
358-
#[cfg_attr(miri, ignore)]
359+
#[cfg_attr(
360+
miri,
361+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
362+
)]
359363
fn find_cargo_toml_recursive() {
360364
let temp_dir = tempfile::tempdir().unwrap();
361365
let nested_dir = temp_dir.path().join("nested");
@@ -373,8 +377,10 @@ mod tests {
373377
}
374378

375379
#[test]
376-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
377-
#[cfg_attr(miri, ignore)]
380+
#[cfg_attr(
381+
miri,
382+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
383+
)]
378384
fn load_valid_virtual_workspace_manifest() {
379385
let cot_cli_root = env!("CARGO_MANIFEST_DIR");
380386
let cot_root = Path::new(cot_cli_root).parent().unwrap();
@@ -390,8 +396,10 @@ mod tests {
390396
}
391397

392398
#[test]
393-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
394-
#[cfg_attr(miri, ignore)]
399+
#[cfg_attr(
400+
miri,
401+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
402+
)]
395403
fn load_valid_workspace_from_package_manifest() {
396404
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
397405
let package_name = temp_dir.path().file_name().unwrap().to_str().unwrap();
@@ -421,8 +429,10 @@ mod tests {
421429
}
422430

423431
#[test]
424-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
425-
#[cfg_attr(miri, ignore)]
432+
#[cfg_attr(
433+
miri,
434+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
435+
)]
426436
fn load_valid_workspace_from_workspace_manifest() {
427437
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
428438
test_utils::make_workspace_package(temp_dir.path(), 3).unwrap();
@@ -446,8 +456,10 @@ mod tests {
446456
}
447457

448458
#[test]
449-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
450-
#[cfg_attr(miri, ignore)]
459+
#[cfg_attr(
460+
miri,
461+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
462+
)]
451463
fn load_valid_package_manifest() {
452464
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
453465
let package_name = temp_dir.path().file_name().unwrap().to_str().unwrap();
@@ -467,8 +479,10 @@ mod tests {
467479
}
468480

469481
#[test]
470-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
471-
#[cfg_attr(miri, ignore)]
482+
#[cfg_attr(
483+
miri,
484+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
485+
)]
472486
fn load_valid_package_manifest_current_dir() {
473487
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
474488
let package_name = temp_dir.path().file_name().unwrap().to_str().unwrap();
@@ -499,8 +513,10 @@ mod tests {
499513
use super::*;
500514

501515
#[test]
502-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
503-
#[cfg_attr(miri, ignore)]
516+
#[cfg_attr(
517+
miri,
518+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
519+
)]
504520
fn get_root_manifest() {
505521
let (temp_dir, manager) = get_workspace(1);
506522
let manifest_path = temp_dir.path().join("Cargo.toml");
@@ -512,8 +528,10 @@ mod tests {
512528
}
513529

514530
#[test]
515-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
516-
#[cfg_attr(miri, ignore)]
531+
#[cfg_attr(
532+
miri,
533+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
534+
)]
517535
fn get_package_manager() {
518536
let (_, manager) = get_workspace(2);
519537
let package_name = test_utils::get_nth_crate_name(1);
@@ -537,8 +555,10 @@ mod tests {
537555
}
538556

539557
#[test]
540-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
541-
#[cfg_attr(miri, ignore)]
558+
#[cfg_attr(
559+
miri,
560+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
561+
)]
542562
fn get_package_manager_by_path() {
543563
let (temp_dir, manager) = get_workspace(1);
544564
let package_name = test_utils::get_nth_crate_name(1);
@@ -580,8 +600,10 @@ mod tests {
580600
use super::*;
581601

582602
#[test]
583-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
584-
#[cfg_attr(miri, ignore)]
603+
#[cfg_attr(
604+
miri,
605+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
606+
)]
585607
fn get_package_name() {
586608
let (temp_dir, manager) = get_package();
587609
let package_name = temp_dir.path().file_name().unwrap().to_str().unwrap();
@@ -590,17 +612,21 @@ mod tests {
590612
}
591613

592614
#[test]
593-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
594-
#[cfg_attr(miri, ignore)]
615+
#[cfg_attr(
616+
miri,
617+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
618+
)]
595619
fn get_package_path() {
596620
let (temp_dir, manager) = get_package();
597621

598622
assert_eq!(manager.get_package_path(), temp_dir.path());
599623
}
600624

601625
#[test]
602-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
603-
#[cfg_attr(miri, ignore)]
626+
#[cfg_attr(
627+
miri,
628+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
629+
)]
604630
fn get_manifest_path() {
605631
let (temp_dir, manager) = get_package();
606632

@@ -611,8 +637,10 @@ mod tests {
611637
}
612638

613639
#[test]
614-
// unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`
615-
#[cfg_attr(miri, ignore)]
640+
#[cfg_attr(
641+
miri,
642+
ignore = "unsupported operation: can't call foreign function `OPENSSL_init_ssl` on OS `linux`"
643+
)]
616644
fn get_manifest() {
617645
let (temp_dir, manager) = get_package();
618646
let manifest_path = temp_dir.path().join("Cargo.toml");

cot-cli/tests/manpages.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#[test]
2-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
2+
#[cfg_attr(
3+
miri,
4+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
5+
)]
36
fn generate_manpages() {
47
let tempdir = tempfile::TempDir::new().unwrap();
58
let args = cot_cli::args::ManpagesArgs {

cot-cli/tests/migration_generator.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ fn create_models_foreign_key_two_migrations() {
163163
/// Test that the migration generator can generate a "create model" migration
164164
/// for a given model which compiles successfully.
165165
#[test]
166-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
166+
#[cfg_attr(
167+
miri,
168+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
169+
)]
167170
fn create_model_compile_test() {
168171
let generator = test_generator();
169172
let src = include_str!("migration_generator/create_model.rs");
@@ -255,7 +258,10 @@ fn find_source_files() {
255258
}
256259

257260
#[test]
258-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
261+
#[cfg_attr(
262+
miri,
263+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
264+
)]
259265
fn list_migrations() {
260266
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
261267
let package_name = temp_dir.path().file_name().unwrap().to_str().unwrap();
@@ -291,7 +297,10 @@ fn list_migrations_missing_cargo_toml() {
291297
}
292298

293299
#[test]
294-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
300+
#[cfg_attr(
301+
miri,
302+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
303+
)]
295304
fn list_migrations_missing_migrations_dir() {
296305
let temp_dir = tempfile::TempDir::with_prefix("cot-test-").unwrap();
297306
test_utils::make_package(temp_dir.path()).unwrap();

cot-cli/tests/new_project.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use std::path::PathBuf;
44
use cot_cli::new_project::{CotSource, new_project};
55

66
#[test]
7-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
7+
#[cfg_attr(
8+
miri,
9+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
10+
)]
811
fn new_project_compile_test() {
912
let temp_dir = tempfile::tempdir().unwrap();
1013
let project_path = temp_dir.path().join("my_project");

cot-macros/src/dbtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn fn_to_dbtest(test_function_decl: ItemFn) -> syn::Result<TokenStrea
1717

1818
let result = quote! {
1919
#[::cot::test]
20-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `sqlite3_open_v2`
20+
#[cfg_attr(miri, ignore = "unsupported operation: can't call foreign function `sqlite3_open_v2`")]
2121
async fn #sqlite_ident() {
2222
let mut database = cot::test::TestDatabase::new_sqlite().await.unwrap();
2323

cot-macros/tests/compile_tests.rs

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
#[rustversion::attr(not(nightly), ignore)]
1+
#[rustversion::attr(
2+
not(nightly),
3+
ignore = "only test on nightly for consistent error messages"
4+
)]
25
#[test]
3-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
6+
#[cfg_attr(
7+
miri,
8+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
9+
)]
410
fn derive_form() {
511
let t = trybuild::TestCases::new();
612
t.pass("tests/ui/derive_form.rs");
713
}
814

9-
#[rustversion::attr(not(nightly), ignore)]
15+
#[rustversion::attr(
16+
not(nightly),
17+
ignore = "only test on nightly for consistent error messages"
18+
)]
1019
#[test]
11-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
20+
#[cfg_attr(
21+
miri,
22+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
23+
)]
1224
fn attr_model() {
1325
let t = trybuild::TestCases::new();
1426
t.pass("tests/ui/attr_model.rs");
@@ -20,18 +32,30 @@ fn attr_model() {
2032
t.compile_fail("tests/ui/attr_model_multiple_pks.rs");
2133
}
2234

23-
#[rustversion::attr(not(nightly), ignore)]
35+
#[rustversion::attr(
36+
not(nightly),
37+
ignore = "only test on nightly for consistent error messages"
38+
)]
2439
#[test]
25-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
40+
#[cfg_attr(
41+
miri,
42+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
43+
)]
2644
fn derive_admin_model() {
2745
let t = trybuild::TestCases::new();
2846
t.pass("tests/ui/derive_admin_model.rs");
2947
t.pass("tests/ui/derive_admin_model_derive_first.rs");
3048
}
3149

32-
#[rustversion::attr(not(nightly), ignore)]
50+
#[rustversion::attr(
51+
not(nightly),
52+
ignore = "only test on nightly for consistent error messages"
53+
)]
3354
#[test]
34-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
55+
#[cfg_attr(
56+
miri,
57+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
58+
)]
3559
fn func_query() {
3660
let t = trybuild::TestCases::new();
3761
t.pass("tests/ui/func_query.rs");
@@ -42,18 +66,30 @@ fn func_query() {
4266
t.compile_fail("tests/ui/func_query_method_call_on_db_field.rs");
4367
}
4468

45-
#[rustversion::attr(not(nightly), ignore)]
69+
#[rustversion::attr(
70+
not(nightly),
71+
ignore = "only test on nightly for consistent error messages"
72+
)]
4673
#[test]
47-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
74+
#[cfg_attr(
75+
miri,
76+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
77+
)]
4878
fn attr_main() {
4979
let t = trybuild::TestCases::new();
5080
t.pass("tests/ui/attr_main.rs");
5181
t.compile_fail("tests/ui/attr_main_args.rs");
5282
}
5383

54-
#[rustversion::attr(not(nightly), ignore)]
84+
#[rustversion::attr(
85+
not(nightly),
86+
ignore = "only test on nightly for consistent error messages"
87+
)]
5588
#[test]
56-
#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri
89+
#[cfg_attr(
90+
miri,
91+
ignore = "unsupported operation: extern static `pidfd_spawnp` is not supported by Miri"
92+
)]
5793
fn derive_from_struct() {
5894
let t = trybuild::TestCases::new();
5995
t.pass("tests/ui/derive_from_request_parts.rs");

cot/src/cli.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,10 @@ mod tests {
484484
}
485485

486486
#[cot::test]
487-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `sqlite3_open_v2`
487+
#[cfg_attr(
488+
miri,
489+
ignore = "unsupported operation: can't call foreign function `sqlite3_open_v2`"
490+
)]
488491
async fn collect_static_execute() {
489492
struct TestApp;
490493
impl App for TestApp {
@@ -528,7 +531,10 @@ mod tests {
528531
}
529532

530533
#[cot::test]
531-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `geteuid` on OS `linux`
534+
#[cfg_attr(
535+
miri,
536+
ignore = "unsupported operation: can't call foreign function `geteuid` on OS `linux`"
537+
)]
532538
#[cfg(feature = "db")]
533539
async fn check_execute_db_fail() {
534540
let config = r#"

cot/src/project.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,10 @@ mod tests {
21282128
}
21292129

21302130
#[cot::test]
2131-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `sqlite3_open_v2`
2131+
#[cfg_attr(
2132+
miri,
2133+
ignore = "unsupported operation: can't call foreign function `sqlite3_open_v2`"
2134+
)]
21322135
async fn bootstrapper() {
21332136
struct TestProject;
21342137
impl Project for TestProject {

cot/src/request/extractors.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,10 @@ mod tests {
743743

744744
#[cfg(feature = "db")]
745745
#[cot::test]
746-
// unsupported operation: can't call foreign function `sqlite3_open_v2` on OS `linux`
747-
#[cfg_attr(miri, ignore)]
746+
#[cfg_attr(
747+
miri,
748+
ignore = "unsupported operation: can't call foreign function `sqlite3_open_v2` on OS `linux`"
749+
)]
748750
async fn request_db() {
749751
let db = crate::test::TestDatabase::new_sqlite().await.unwrap();
750752
let mut test_request = TestRequestBuilder::get("/").database(db.database()).build();

0 commit comments

Comments
 (0)