Skip to content

Commit 88dbc39

Browse files
committed
style(component): reduce right drift in ComponentPart::decode()
1 parent 185db77 commit 88dbc39

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/dist/component/components.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,14 @@ impl ComponentPart {
177177
}
178178

179179
pub(crate) fn decode(line: &str) -> Option<Self> {
180-
line.find(':').map(|pos| {
181-
let mut path_str = Cow::Borrowed(&line[(pos + 1)..]);
182-
if Self::PATH_SEP_MANIFEST != Self::PATH_SEP_MAIN {
183-
path_str =
184-
Cow::Owned(path_str.replace(Self::PATH_SEP_MANIFEST, Self::PATH_SEP_MAIN));
185-
};
186-
Self {
187-
kind: line[0..pos].to_owned(),
188-
path: PathBuf::from(path_str.as_ref()),
189-
}
180+
let pos = line.find(':')?;
181+
let mut path_str = Cow::Borrowed(&line[(pos + 1)..]);
182+
if Self::PATH_SEP_MANIFEST != Self::PATH_SEP_MAIN {
183+
path_str = Cow::Owned(path_str.replace(Self::PATH_SEP_MANIFEST, Self::PATH_SEP_MAIN));
184+
};
185+
Some(Self {
186+
kind: line[0..pos].to_owned(),
187+
path: PathBuf::from(path_str.as_ref()),
190188
})
191189
}
192190
}

0 commit comments

Comments
 (0)