Skip to content

Commit bacf792

Browse files
committed
tidy: Extract let mut part out of parts block in version.rs
1 parent 1937bf2 commit bacf792

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/tools/tidy/src/features/version.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ impl FromStr for Version {
3131
fn from_str(s: &str) -> Result<Self, Self::Err> {
3232
let mut iter = s.split('.').map(|part| Ok(part.parse()?));
3333

34-
let parts = {
35-
let mut part = || {
36-
iter.next()
37-
.unwrap_or(Err(ParseVersionError::WrongNumberOfParts))
38-
};
39-
40-
[part()?, part()?, part()?]
34+
let mut part = || {
35+
iter.next()
36+
.unwrap_or(Err(ParseVersionError::WrongNumberOfParts))
4137
};
4238

39+
let parts = [part()?, part()?, part()?];
40+
4341
if let Some(_) = iter.next() {
4442
// Ensure we don't have more than 3 parts.
4543
return Err(ParseVersionError::WrongNumberOfParts);

0 commit comments

Comments
 (0)