From 9a9d3baf9628628a668ec79535ba3d08526f4655 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 29 Mar 2016 17:22:46 +0200 Subject: [PATCH] simplify --- src/Paket.Core/SemVer.fs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Paket.Core/SemVer.fs b/src/Paket.Core/SemVer.fs index 5df842d41c..2159e90b48 100644 --- a/src/Paket.Core/SemVer.fs +++ b/src/Paket.Core/SemVer.fs @@ -114,17 +114,9 @@ type SemVerInfo = sprintf "%d.%d.%d%s%s" x.Major x.Minor x.Patch build pre member x.NormalizeToShorter() = - let build = - if String.IsNullOrEmpty x.Build |> not && x.Build <> "0" then "." + x.Build - else "" - - let pre = - match x.PreRelease with - | Some preRelease -> sprintf "-%s" preRelease.Origin - | None -> "" - - let s = sprintf "%d.%d.%d%s%s" x.Major x.Minor x.Patch build pre - if s = sprintf "%d.%d.0" x.Major x.Minor then sprintf "%d.%d" x.Major x.Minor else s + let s = x.Normalize() + let s2 = sprintf "%d.%d" x.Major x.Minor + if s = s2 + ".0" then s2 else s override x.ToString() = match x.Original with