Skip to content

Commit

Permalink
Fix clippy lints (#23)
Browse files Browse the repository at this point in the history
* Remove unnecessary reference

LineParser::substitution_data is already `&mut` so there's no
need to create a reference before passing.

Addresses a clippy issue.

* Use the non_exhaustive annotation on dotenv::Error

The #[non_exhaustive] attribute achieves the same compatibility
reservations as a dummy variant without requiring code to
handle that variant.

Addresses a clippy issue.
  • Loading branch information
rillian authored Oct 16, 2022
1 parent 778654c commit 9d0f3de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions dotenv/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ use std::io;
pub type Result<T> = std::result::Result<T, Error>;

#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
LineParse(String, usize),
Io(io::Error),
EnvVar(env::VarError),
#[doc(hidden)]
__Nonexhaustive,
}

impl Error {
Expand Down Expand Up @@ -43,7 +42,6 @@ impl fmt::Display for Error {
"Error parsing line: '{}', error at line index: {}",
line, error_index
),
_ => unreachable!(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dotenv/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'a> LineParser<'a> {
return Ok(Some((key, String::new())));
}

let parsed_value = parse_value(self.line, &mut self.substitution_data)?;
let parsed_value = parse_value(self.line, self.substitution_data)?;
self.substitution_data
.insert(key.clone(), Some(parsed_value.clone()));

Expand Down

0 comments on commit 9d0f3de

Please sign in to comment.