User avatar
Soblow Xaselgio dragn_heart @Soblow@eldritch.cafe
2w
Clippy raising warnings on all my tests because... I did not document that the function could panic.

... Yeah? That's the dirting goal?
1
0
0
0
User avatar
Soblow Xaselgio dragn_heart @Soblow@eldritch.cafe
2w
Yummies

github.com/rust-lang/rust-clippy/issues/12265
1
0
0
0
User avatar
[4FBB09] @5225225@furry.engineer
2w
@Soblow yeah, should be able to #[allow] or expect that lint on the tests module though, at least
1
0
0
0
User avatar
Soblow Xaselgio dragn_heart @Soblow@eldritch.cafe
2w
@5225225 Problem is that, on this project, we have test module*s*, so I have to put this allow directive on all imports dragn_happy
1
0
1
0
User avatar
celeste_hearts_lesbianceleste_hearts_transceleste_hearts_demisexual flori_ava_star:~cursor_blinking 🔜@DS26 @star@amazonawaws.com
1w
@Soblow @5225225 nop! neocat_floof_cute neocat_shy one can, in the lib.rs, at the top of the file

#![cfg_attr(test, allow(...))]
2
0
1
0
User avatar
[4FBB09] @5225225@furry.engineer
1w
@star @Soblow though wouldn't you need to run clippy twice then, one with test enabled and one without? i forget if cargo clippy has test on by default
2
0
1
0
User avatar
celeste_hearts_lesbianceleste_hearts_transceleste_hearts_demisexual flori_ava_star:~cursor_blinking 🔜@DS26 @star@amazonawaws.com
1w
@5225225 @Soblow nyonyo, cfg_attr(test, ...) only applies for things compiled under the test environment, such as test modules marked #[cfg(test)], or tests themselves; ...if I am not mistaken
2
0
0
0
User avatar
[4FBB09] @5225225@furry.engineer
1w
@star @Soblow hmm...

okay, just tested it, and
--all-targets does indeed seem to just check it (at least) twice, once with cfg(test) and once without. which, i guess makes sense given the name.

(this can be noticed by adding a compile time assert that
cfg!(test) == true (or == false), both of which will fail when clippy's compiling the code for the other one.)
1
0
1
0
User avatar
celeste_hearts_lesbianceleste_hearts_transceleste_hearts_demisexual flori_ava_star:~cursor_blinking 🔜@DS26 @star@amazonawaws.com
1w
@5225225 @Soblow Which means you only need to run it once? /genq
1
0
1
0
User avatar
[4FBB09] @5225225@furry.engineer
1w
@star @Soblow yes, correct, cargo clippy --all-targets and cfg_attr(test, ...) seems to behave as desired here(any lint failures outside of test modules will be warned on).

(ofc, worth testing in your own setup before relying on it, but that's not hard to do)
1
0
1
0
User avatar
celeste_hearts_lesbianceleste_hearts_transceleste_hearts_demisexual flori_ava_star:~cursor_blinking 🔜@DS26 @star@amazonawaws.com
1w
@5225225 @Soblow Ok good, then my memory and intuition served me correctly :3 thankz
0
0
1
0