Skip to content

Unable to disable warning when using derive #10556

@alexkazik

Description

@alexkazik

Summary

I want to silence a clippy warning.

I did stick the allow to all places I thought possible.

It is silenced without the derive.

Lint Name

type_complexity

Reproducer

I tried this code:

use std::borrow::Cow; #[derive(serde::Serialize, serde::Deserialize)] pub enum EncounterType {} #[allow(clippy::type_complexity)] #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::type_complexity)] pub struct SerdeEncounter<'a>( #[allow(clippy::type_complexity)] Vec<(Cow<'a, str>, Vec<EncounterType>, usize, Cow<'a, str>)>, );

I saw this happen:

warning: very complex type used. Consider factoring parts into `type` definitions --> app/src/lib.rs:99:39 | 99 | #[allow(clippy::type_complexity)] Vec<(Cow<'a, str>, Vec<EncounterType>, usize, Cow<'a, str>)>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity 

I expected to see this happen:
Nothing

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=779725236b9bfeccf85248c64f8acd49

Version

tested on play.rust-lang.org, which reports: stable rust 1.68.1 clippy 0.1.70 (2023-03-26 db0cbc4) 

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions