From fe34295076522c0ea5543f031333163689d131c5 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 12 Jan 2024 23:44:52 +0100 Subject: [PATCH] Fix clippy lints Clippy linting had some complaints: warning: you seem to be trying to move all elements into a new `String` --> dotenv/src/parse.rs:183:34 | 183 | ... &substitution_name.drain(..).collect::(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `mem::take`: `std::mem::take(&mut substitution_name)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drain_collect = note: `#[warn(clippy::drain_collect)]` on by default All reported instances of that lint are fixed. --- dotenv/src/parse.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dotenv/src/parse.rs b/dotenv/src/parse.rs index 8e7842ed..642174e9 100644 --- a/dotenv/src/parse.rs +++ b/dotenv/src/parse.rs @@ -180,7 +180,7 @@ fn parse_value( } else { apply_substitution( substitution_data, - &substitution_name.drain(..).collect::(), + &std::mem::take(&mut substitution_name), &mut output, ); if c == '$' { @@ -200,7 +200,7 @@ fn parse_value( substitution_mode = SubstitutionMode::None; apply_substitution( substitution_data, - &substitution_name.drain(..).collect::(), + &std::mem::take(&mut substitution_name), &mut output, ); } else { @@ -250,7 +250,7 @@ fn parse_value( } else { apply_substitution( substitution_data, - &substitution_name.drain(..).collect::(), + &std::mem::take(&mut substitution_name), &mut output, ); Ok(output)