// run-rustfix
+// aux-build:macro_rules.rs
#![deny(clippy::try_err)]
+#[macro_use]
+extern crate macro_rules;
+
// Tests that a simple case works
// Should flag `Err(err)?`
pub fn basic_test() -> Result<i32, i32> {
negative_test().unwrap();
closure_matches_test().unwrap();
closure_into_test().unwrap();
+
+ // We don't want to lint in external macros
+ try_err!();
+}
+
+macro_rules! bar {
+ () => {
+ String::from("aasdfasdfasdfa")
+ };
+}
+
+macro_rules! foo {
+ () => {
+ bar!()
+ };
+}
+
+pub fn macro_inside(fail: bool) -> Result<i32, String> {
+ if fail {
+ Err(foo!())?;
+ }
+ Ok(0)
}