summaryrefslogtreecommitdiffstats
path: root/vendor/gix-config/src/file/mutable/section.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix-config/src/file/mutable/section.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-config/src/file/mutable/section.rs')
-rw-r--r--vendor/gix-config/src/file/mutable/section.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/vendor/gix-config/src/file/mutable/section.rs b/vendor/gix-config/src/file/mutable/section.rs
index def68ac60..336ccad2d 100644
--- a/vendor/gix-config/src/file/mutable/section.rs
+++ b/vendor/gix-config/src/file/mutable/section.rs
@@ -123,10 +123,10 @@ impl<'a, 'event> SectionMut<'a, 'event> {
/// Sets the last key value pair if it exists, or adds the new value.
/// Returns the previous value if it replaced a value, or None if it adds
/// the value.
- pub fn set<'b>(&mut self, key: Key<'event>, value: impl Into<&'b BStr>) -> Option<Cow<'event, BStr>> {
+ pub fn set(&mut self, key: Key<'event>, value: &BStr) -> Option<Cow<'event, BStr>> {
match self.key_and_value_range_by(&key) {
None => {
- self.push(key, Some(value.into()));
+ self.push(key, Some(value));
None
}
Some((key_range, value_range)) => {
@@ -136,15 +136,15 @@ impl<'a, 'event> SectionMut<'a, 'event> {
self.section
.body
.0
- .insert(range_start, Event::Value(escape_value(value.into()).into()));
+ .insert(range_start, Event::Value(escape_value(value).into()));
Some(ret)
}
}
}
/// Removes the latest value by key and returns it, if it exists.
- pub fn remove(&mut self, key: impl AsRef<str>) -> Option<Cow<'event, BStr>> {
- let key = Key::from_str_unchecked(key.as_ref());
+ pub fn remove(&mut self, key: &str) -> Option<Cow<'event, BStr>> {
+ let key = Key::from_str_unchecked(key);
let (key_range, _value_range) = self.key_and_value_range_by(&key)?;
Some(self.remove_internal(key_range, true))
}
@@ -185,7 +185,7 @@ impl<'a, 'event> SectionMut<'a, 'event> {
assert!(
whitespace
.as_deref()
- .map_or(true, |ws| ws.iter().all(|b| b.is_ascii_whitespace())),
+ .map_or(true, |ws| ws.iter().all(u8::is_ascii_whitespace)),
"input whitespace must only contain whitespace characters."
);
self.whitespace.pre_key = whitespace;