mirror of https://github.com/rwf2/Rocket.git
Fix 'clippy::needless_late_init' in form codegen.
Changes codegen for '#[field(default = e)]' to resolve the 'needless_late_init' Clippy warning.
This commit is contained in:
parent
1587c501f3
commit
6f223518e4
|
@ -392,12 +392,11 @@ pub fn default<'v>(field: Field<'v>) -> Result<Option<TokenStream>> {
|
|||
},
|
||||
(Some(e), None) | (None, Some(e)) => {
|
||||
Ok(Some(quote_spanned!(e.span() => {
|
||||
let __default: Option<#ty>;
|
||||
if __opts.strict {
|
||||
__default = None;
|
||||
let __default: Option<#ty> = if __opts.strict {
|
||||
None
|
||||
} else {
|
||||
__default = #e;
|
||||
}
|
||||
#e
|
||||
};
|
||||
|
||||
__default
|
||||
})))
|
||||
|
|
Loading…
Reference in New Issue