Where is the implementation of macro `allow`?

    #[allow(clippy::too_many_arguments)]
    async fn set<'a>(&'a self, key: K, value: V, ttl: NonZeroU64) -> anyhow::Result<()> {
        let ttl = Duration::from_millis(ttl.get());
        self.data.write().unwrap().insert(key, value, ttl);
        Ok(())
    }

As above code shown, allow is a macro to ignore some clippy warning, I tried to find its implementation by rust-analyzer but failed with message no definition found for allow.

It's not a macro. It's a built-in compiler attribute, and it's analyzed by the linter passes.

Most attributes are just that, metadata attached to code. Some atributes may be macros, but most aren't, particularly the built-in ones. If you really want to understand in detail how they work, you should read the source of the compiler, but that shouldn't be necessary.

Attributes can be classified into the following kinds:

— from https://doc.rust-lang.org/reference/attributes.html

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.