We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 005538f commit d299d37Copy full SHA for d299d37
gix-config-value/src/path.rs
@@ -113,7 +113,9 @@ impl<'a> From<Cow<'a, BStr>> for Path<'a> {
113
fn from(value: Cow<'a, BStr>) -> Self {
114
// Check if the value starts with ":(optional)" prefix
115
if value.starts_with(OPTIONAL_PREFIX) {
116
- // Strip the prefix while preserving the Cow variant to avoid unnecessary allocations
+ // Strip the prefix while preserving the Cow variant for efficiency:
117
+ // - Borrowed data remains borrowed (no allocation)
118
+ // - Owned data is modified in-place using drain (no extra allocation)
119
let stripped = match value {
120
Cow::Borrowed(b) => Cow::Borrowed(&b[OPTIONAL_PREFIX.len()..]),
121
Cow::Owned(mut b) => {
0 commit comments