You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[rstest]#[case("[optional ", "expected opening bracket at byte index 9")]fnerror_display_owned(#[case]format_description:&'static str,#[case]error:&'static str){assert_eq!(
format_description::parse_owned::<2>(format_description)
.unwrap_err()
.to_string(),
error
);}
This correctly triggers clippy::unwrap_used. However, placing #[allow(clippy::unwrap_used)] on the function does not silence the lint. This is the case regardless of the position of the attribute.
Here is the current expansion (without an #[allow] attribute).
// `#[allow]` needs to be present here.#[cfg(test)]fnerror_display_owned(format_description:&'static str,error:&'static str){{assert_eq!(
format_description::parse_owned::<2>(format_description)
.unwrap_err()
.to_string(),
error
);}}#[cfg(test)]mod error_display_owned {usesuper::*;#[test]fncase_1(){let format_description = {use rstest::magic_conversion::*;(&&&Magic::<&'static str>(std::marker::PhantomData)).magic_conversion("[optional ")};let error = {use rstest::magic_conversion::*;(&&&Magic::<&'static str>(std::marker::PhantomData)).magic_conversion("expected opening bracket at byte index 9")};error_display_owned(format_description, error)}}
Perhaps #[allow], #[warn], #[deny], and #[forbid] should be special-cased such that they are copied onto the resulting function? I have no idea how feasible this is.
The text was updated successfully, but these errors were encountered:
I should think about that. I guessed that the attributes before the function should act as test's attributes but maybe I was wrong. Maybe only a small subset like should_panic, ignore and skip are test's attributes.
I'm little scared because when the user use the injected tests attribute I cannot know what attributes this test attribute will handle... I can handle all standard attributes as tests attributes and move the others to the function but I should also introduce a syntax that the user can use to force some attribute to be applied to the test instead the function.
This correctly triggers
clippy::unwrap_used
. However, placing#[allow(clippy::unwrap_used)]
on the function does not silence the lint. This is the case regardless of the position of the attribute.Here is the current expansion (without an
#[allow]
attribute).Perhaps
#[allow]
,#[warn]
,#[deny]
, and#[forbid]
should be special-cased such that they are copied onto the resulting function? I have no idea how feasible this is.The text was updated successfully, but these errors were encountered: