From 60c4816d305389ae19a38fe45e37dcf45c5691b0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 26 Oct 2022 22:04:24 +0200 Subject: [PATCH] Add `#[allow(clippy::should_implement_trait)]` if method is named `default` --- src/codegen/function.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/codegen/function.rs b/src/codegen/function.rs index 8072bfab8..401e0cd2b 100644 --- a/src/codegen/function.rs +++ b/src/codegen/function.rs @@ -118,9 +118,20 @@ pub fn generate( "" }; + let allow_should_implement_trait = if analysis.codegen_name() == "default" { + format!( + "{}{}#[allow(clippy::should_implement_trait)]", + tabs(indent), + comment_prefix + ) + } else { + String::new() + }; + writeln!( w, - "{}{}{}{}{}{}{}{}", + "{}{}{}{}{}{}{}{}{}", + allow_should_implement_trait, dead_code_cfg, get_must_use_if_needed( parent_type_id,