History

thanks clippy

Sebastian Thiel committed 4 years ago

Commit 9b6a67b1 parent aa630ad5 files · +8 −13Browse files

Unified · Split

5 files
  1. git-config/src/file/access/comfort.rs +2 −2
  2. git-config/src/file/access/raw.rs +1 −1
  3. git-config/src/file/from_env.rs +1 −1
  4. git-config/src/file/resolve_includes.rs +1 −1
  5. git-config/src/values.rs +3 −8
git-config/src/file/access/comfort.rs+2−2
@@ -13,7 +13,7 @@ impl<'a> File<'a> { · 12 unmodified lines
13 pub fn string(&'a self, section_name: &str, subsection_name: Option<&str>, key: &str) -> Option<Cow<'a, BStr>> {13 pub fn string(&'a self, section_name: &str, subsection_name: Option<&str>, key: &str) -> Option<Cow<'a, BStr>> {
14 self.raw_value(section_name, subsection_name, key)14 self.raw_value(section_name, subsection_name, key)
15 .ok()15 .ok()
16 .map(|v| normalize_cow(v))16 .map(normalize_cow)
17 }17 }
18 18
19 /// Like [`value()`][File::value()], but returning an `Option` if the path wasn't found.19 /// Like [`value()`][File::value()], but returning an `Option` if the path wasn't found.
@@ -61,7 +61,7 @@ impl<'a> File<'a> { · 41 unmodified lines
61 pub fn strings(&self, section_name: &str, subsection_name: Option<&str>, key: &str) -> Option<Vec<Cow<'_, BStr>>> {61 pub fn strings(&self, section_name: &str, subsection_name: Option<&str>, key: &str) -> Option<Vec<Cow<'_, BStr>>> {
62 self.raw_multi_value(section_name, subsection_name, key)62 self.raw_multi_value(section_name, subsection_name, key)
63 .ok()63 .ok()
64 .map(|values| values.into_iter().map(|v| normalize_cow(v)).collect())64 .map(|values| values.into_iter().map(normalize_cow).collect())
65 }65 }
66 66
67 /// Similar to [`multi_value(…)`][File::multi_value()] but returning integers if at least one of them was found67 /// Similar to [`multi_value(…)`][File::multi_value()] but returning integers if at least one of them was found
git-config/src/file/access/raw.rs+1−1
@@ -173,7 +173,7 @@ impl<'a> File<'a> { · 172 unmodified lines
173 .expect("sections does not have section id from section ids")173 .expect("sections does not have section id from section ids")
174 .values(&Key(Cow::<BStr>::Borrowed(key.into())))174 .values(&Key(Cow::<BStr>::Borrowed(key.into())))
175 .iter()175 .iter()
176 .map(|v| v.clone()),176 .cloned(),
177 );177 );
178 }178 }
179 179
git-config/src/file/from_env.rs+1−1
@@ -116,7 +116,7 @@ impl<'a> File<'a> { · 115 unmodified lines
116 116
117 section.push(117 section.push(
118 parser::Key(Cow::Owned(BString::from(key))),118 parser::Key(Cow::Owned(BString::from(key))),
119 Cow::Owned(git_path::into_bstr(PathBuf::from(value)).into_owned().into()),119 Cow::Owned(git_path::into_bstr(PathBuf::from(value)).into_owned()),
120 );120 );
121 } else {121 } else {
122 return Err(Error::InvalidKeyValue {122 return Err(Error::InvalidKeyValue {
git-config/src/file/resolve_includes.rs+1−1
@@ -137,7 +137,7 @@ fn onbranch_matches(condition: &BStr, options: Options<'_>) -> Option<()> { · 136 unmodified lines
137 };137 };
138 138
139 git_glob::wildmatch(139 git_glob::wildmatch(
140 condition.as_ref().into(),140 condition.as_ref(),
141 branch_name,141 branch_name,
142 git_glob::wildmatch::Mode::NO_MATCH_SLASH_LITERAL,142 git_glob::wildmatch::Mode::NO_MATCH_SLASH_LITERAL,
143 )143 )
git-config/src/values.rs+3−8
@@ -305,12 +305,7 @@ impl<'a> AsRef<BStr> for Path<'a> { · 304 unmodified lines
305 305
306impl<'a> From<Cow<'a, BStr>> for Path<'a> {306impl<'a> From<Cow<'a, BStr>> for Path<'a> {
307 fn from(value: Cow<'a, BStr>) -> Self {307 fn from(value: Cow<'a, BStr>) -> Self {
308 Path {308 Path { value }
309 value: match value {
310 Cow::Borrowed(v) => Cow::Borrowed(v.into()),
311 Cow::Owned(v) => Cow::Owned(v.into()),
312 },
313 }
314 }309 }
315}310}
316 311
@@ -382,7 +377,7 @@ impl TryFrom<BString> for Boolean<'_> { · 65 unmodified lines
382 || value.eq_ignore_ascii_case(b"zero")377 || value.eq_ignore_ascii_case(b"zero")
383 || value == "\"\""378 || value == "\"\""
384 {379 {
385 return Ok(Self::False(Cow::Owned(value.into())));380 return Ok(Self::False(Cow::Owned(value)));
386 }381 }
387 382
388 TrueVariant::try_from(value).map(Self::True)383 TrueVariant::try_from(value).map(Self::True)
@@ -489,7 +484,7 @@ impl TryFrom<BString> for TrueVariant<'_> { · 100 unmodified lines
489 || value.eq_ignore_ascii_case(b"true")484 || value.eq_ignore_ascii_case(b"true")
490 || value.eq_ignore_ascii_case(b"one")485 || value.eq_ignore_ascii_case(b"one")
491 {486 {
492 Ok(Self::Explicit(Cow::Owned(value.into())))487 Ok(Self::Explicit(Cow::Owned(value)))
493 } else if value.is_empty() {488 } else if value.is_empty() {
494 Ok(Self::Implicit)489 Ok(Self::Implicit)
495 } else {490 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t