Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
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::<String>(),
        |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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.
  • Loading branch information
striezel committed Jan 12, 2024
1 parent 207afca commit fe34295
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dotenv/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn parse_value(
} else {
apply_substitution(
substitution_data,
&substitution_name.drain(..).collect::<String>(),
&std::mem::take(&mut substitution_name),
&mut output,
);
if c == '$' {
Expand All @@ -200,7 +200,7 @@ fn parse_value(
substitution_mode = SubstitutionMode::None;
apply_substitution(
substitution_data,
&substitution_name.drain(..).collect::<String>(),
&std::mem::take(&mut substitution_name),
&mut output,
);
} else {
Expand Down Expand Up @@ -250,7 +250,7 @@ fn parse_value(
} else {
apply_substitution(
substitution_data,
&substitution_name.drain(..).collect::<String>(),
&std::mem::take(&mut substitution_name),
&mut output,
);
Ok(output)
Expand Down

0 comments on commit fe34295

Please sign in to comment.