Skip to content

Commit 137d14c

Browse files
committed
Resolve mem_replace_with_default clippy lint
warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> src/expand.rs:195:30 | 195 | let bounds = mem::replace(&mut param.bounds, Punctuated::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut param.bounds)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default = note: `-W clippy::mem-replace-with-default` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::mem_replace_with_default)]` warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> src/expand.rs:206:30 | 206 | let bounds = mem::replace(&mut param.bounds, Punctuated::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut param.bounds)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default
1 parent 45fd82a commit 137d14c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/expand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn transform_sig(
192192
Some(colon_token) => colon_token.span,
193193
None => param_name.span(),
194194
};
195-
let bounds = mem::replace(&mut param.bounds, Punctuated::new());
195+
let bounds = mem::take(&mut param.bounds);
196196
where_clause_or_default(&mut sig.generics.where_clause)
197197
.predicates
198198
.push(parse_quote_spanned!(span=> #param_name: 'async_trait + #bounds));
@@ -203,7 +203,7 @@ fn transform_sig(
203203
Some(colon_token) => colon_token.span,
204204
None => param_name.span(),
205205
};
206-
let bounds = mem::replace(&mut param.bounds, Punctuated::new());
206+
let bounds = mem::take(&mut param.bounds);
207207
where_clause_or_default(&mut sig.generics.where_clause)
208208
.predicates
209209
.push(parse_quote_spanned!(span=> #param: 'async_trait + #bounds));

0 commit comments

Comments
 (0)