Skip to content

Commit 8cece1c

Browse files
--amend
1 parent 1d16cb4 commit 8cece1c

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

crates/uv-pep440/src/version.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -725,17 +725,7 @@ impl std::fmt::Display for Version {
725725
let local = if self.local().is_empty() {
726726
String::new()
727727
} else {
728-
format!(
729-
"+{}",
730-
match self.local() {
731-
LocalVersionSlice::Actual(segments) => segments
732-
.iter()
733-
.map(ToString::to_string)
734-
.collect::<Vec<String>>()
735-
.join("."),
736-
LocalVersionSlice::Sentinel => String::from("<max-local-version>"),
737-
}
738-
)
728+
format!("+{}", self.local().local_identifier_string())
739729
};
740730
write!(f, "{epoch}{release}{pre}{post}{dev}{local}")
741731
}
@@ -1440,15 +1430,15 @@ impl LocalVersion {
14401430
}
14411431

14421432
impl LocalVersionSlice<'_> {
1443-
/// output the local version identifier string. [`LocalVersionSlice::Sentinel`] maps to `"<max-local-version>"` which is otherwise an illegal local version because `<` and `>` are not allowed
1433+
/// output the local version identifier string. [`LocalVersionSlice::Sentinel`] maps to `"[max-local-version]"` which is otherwise an illegal local version because `<` and `>` are not allowed
14441434
pub fn local_identifier_string(&self) -> String {
14451435
match self {
14461436
LocalVersionSlice::Actual(segments) => segments
14471437
.iter()
14481438
.map(ToString::to_string)
14491439
.collect::<Vec<String>>()
14501440
.join("."),
1451-
LocalVersionSlice::Sentinel => String::from("<max-local-version>"),
1441+
LocalVersionSlice::Sentinel => String::from("[max-local-version]"),
14521442
}
14531443
}
14541444
}

0 commit comments

Comments
 (0)