duplicated_attributes: false positive with apistos crate #13238
Open
Description
Summary
The duplicated_attributes
lint yields false positives when using the apistos crate for OpenAPI documentation.
Lint Name
duplicated_attributes
Reproducer
I tried this code:
#[derive(Debug, Serialize, JsonSchema, ApiErrorComponent)]
#[openapi_error(
status(code = 400, description = "An invalid request has been made."),
status(code = 404, description = "The specified resource has not been found."),
status(code = 500, description = "An internal server error occurred.")
)]
pub enum ErrorResponse {
BadRequest(String),
InternalServerError(String),
NotFound(String),
}
I saw this happen:
warning: duplicated attribute
--> service/src/api/error_response.rs:12:12
|
12 | status(code = 404, description = "The specified resource has not been found."),
| ^^^^^^^^^^
|
note: first defined here
--> service/src/api/error_response.rs:11:12
|
11 | status(code = 400, description = "An invalid request has been made."),
| ^^^^^^^^^^
help: remove this attribute
--> service/src/api/error_response.rs:12:12
|
12 | status(code = 404, description = "The specified resource has not been found."),
| ^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes
= note: `-W clippy::duplicated-attributes` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::duplicated_attributes)]`
I expected to see this happen:
No warnings should be emitted.
Version
rustc 1.80.0 (051478957 2024-07-21)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: aarch64-apple-darwin
release: 1.80.0
LLVM version: 18.1.7
Additional Labels
No response
Activity