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
1313 pub fn string(&'a self, section_name: &str, subsection_name: Option<&str>, key: &str) -> Option<Cow<'a, BStr>> {
1414 self.raw_value(section_name, subsection_name, key)
1515 .ok()
16− .map(|v| normalize_cow(v))
16+ .map(normalize_cow)
1717 }
1818
1919 /// 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
6161 pub fn strings(&self, section_name: &str, subsection_name: Option<&str>, key: &str) -> Option<Vec<Cow<'_, BStr>>> {
6262 self.raw_multi_value(section_name, subsection_name, key)
6363 .ok()
64− .map(|values| values.into_iter().map(|v| normalize_cow(v)).collect())
64+ .map(|values| values.into_iter().map(normalize_cow).collect())
6565 }
6666
6767 /// 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
173173 .expect("sections does not have section id from section ids")
174174 .values(&Key(Cow::<BStr>::Borrowed(key.into())))
175175 .iter()
176− .map(|v| v.clone()),
176+ .cloned(),
177177 );
178178 }
179179
git-config/src/file/from_env.rs+1−1
@@ -116,7 +116,7 @@ impl<'a> File<'a> { · 115 unmodified lines
116116
117117 section.push(
118118 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()),
120120 );
121121 } else {
122122 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
137137 };
138138
139139 git_glob::wildmatch(
140− condition.as_ref().into(),
140+ condition.as_ref(),
141141 branch_name,
142142 git_glob::wildmatch::Mode::NO_MATCH_SLASH_LITERAL,
143143 )
git-config/src/values.rs+3−8
@@ -305,12 +305,7 @@ impl<'a> AsRef<BStr> for Path<'a> { · 304 unmodified lines
305305
306306 impl<'a> From<Cow<'a, BStr>> for Path<'a> {
307307 fn from(value: Cow<'a, BStr>) -> Self {
308− Path {
309− value: match value {
310− Cow::Borrowed(v) => Cow::Borrowed(v.into()),
311− Cow::Owned(v) => Cow::Owned(v.into()),
312− },
313− }
308+ Path { value }
314309 }
315310 }
316311
@@ -382,7 +377,7 @@ impl TryFrom<BString> for Boolean<'_> { · 65 unmodified lines
382377 || value.eq_ignore_ascii_case(b"zero")
383378 || value == "\"\""
384379 {
385− return Ok(Self::False(Cow::Owned(value.into())));
380+ return Ok(Self::False(Cow::Owned(value)));
386381 }
387382
388383 TrueVariant::try_from(value).map(Self::True)
@@ -489,7 +484,7 @@ impl TryFrom<BString> for TrueVariant<'_> { · 100 unmodified lines
489484 || value.eq_ignore_ascii_case(b"true")
490485 || value.eq_ignore_ascii_case(b"one")
491486 {
492− Ok(Self::Explicit(Cow::Owned(value.into())))
487+ Ok(Self::Explicit(Cow::Owned(value)))
493488 } else if value.is_empty() {
494489 Ok(Self::Implicit)
495490 } 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