fix lints

This commit is contained in:
Edward Shen 2021-03-05 16:34:29 -05:00
parent a345a8d93e
commit ce2529fa9d
Signed by: edward
GPG key ID: 19182661E818369F
3 changed files with 10 additions and 2 deletions

View file

@ -73,6 +73,10 @@ pub struct MutableValue<'borrow, 'lookup, 'event> {
impl MutableValue<'_, '_, '_> { impl MutableValue<'_, '_, '_> {
/// Returns the actual value. This is computed each time this is called, so /// Returns the actual value. This is computed each time this is called, so
/// it's best to reuse this value or own it if an allocation is acceptable. /// it's best to reuse this value or own it if an allocation is acceptable.
///
/// # Errors
///
/// Returns an error if the lookup failed.
pub fn value(&self) -> Result<Cow<'_, [u8]>, GitConfigError> { pub fn value(&self) -> Result<Cow<'_, [u8]>, GitConfigError> {
let mut found_key = false; let mut found_key = false;
let mut latest_value = None; let mut latest_value = None;
@ -144,6 +148,10 @@ pub struct MutableMultiValue<'borrow, 'lookup, 'event> {
impl<'event> MutableMultiValue<'_, '_, 'event> { impl<'event> MutableMultiValue<'_, '_, 'event> {
/// Returns the actual values. This is computed each time this is called. /// Returns the actual values. This is computed each time this is called.
///
/// # Errors
///
/// Returns an error if the lookup failed.
pub fn value(&self) -> Result<Vec<Cow<'_, [u8]>>, GitConfigError> { pub fn value(&self) -> Result<Vec<Cow<'_, [u8]>>, GitConfigError> {
let mut found_key = false; let mut found_key = false;
let mut values = vec![]; let mut values = vec![];
@ -255,7 +263,7 @@ impl<'event> MutableMultiValue<'_, '_, 'event> {
/// Sets all values in this multivar to the provided one by copying the /// Sets all values in this multivar to the provided one by copying the
/// input for all values. /// input for all values.
#[inline] #[inline]
pub fn set_string_all(&mut self, input: String) { pub fn set_string_all(&mut self, input: &str) {
self.set_owned_values_all(input.as_bytes()) self.set_owned_values_all(input.as_bytes())
} }

View file

@ -1,7 +1,6 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![deny(missing_docs)] #![deny(missing_docs)]
#![warn(clippy::pedantic, clippy::nursery, clippy::cargo)] #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(clippy::shadow_unrelated)]
//! # `git_config` //! # `git_config`
//! //!

View file

@ -624,6 +624,7 @@ pub fn parse_from_str(input: &str) -> Result<Parser<'_>, Error> {
/// Returns an error if the string provided is not a valid `git-config`. /// Returns an error if the string provided is not a valid `git-config`.
/// This generally is due to either invalid names or if there's extraneous /// This generally is due to either invalid names or if there's extraneous
/// data succeeding valid `git-config` data. /// data succeeding valid `git-config` data.
#[allow(clippy::shadow_unrelated)]
pub fn parse_from_bytes(input: &[u8]) -> Result<Parser<'_>, Error> { pub fn parse_from_bytes(input: &[u8]) -> Result<Parser<'_>, Error> {
let mut newlines = 0; let mut newlines = 0;
let (i, frontmatter) = many0(alt(( let (i, frontmatter) = many0(alt((