From b62546ae4a7bc516ecb0889cd102bc03a2ab823a Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 12 May 2022 10:39:50 +0900 Subject: [PATCH] Simplify version parsing Co-authored-by: Mara Bos --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cf44929..8a9ea01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -989,8 +989,7 @@ impl Version { // // CMake suite maintained and supported by Kitware (kitware.com/cmake). // ``` - let version = s.lines().find(|s| s.starts_with("cmake version "))?; - let version = &version["cmake version ".len()..]; // strip prefix + let version = s.lines().next()?.strip_prefix("cmake version ")?; let mut digits = version.splitn(3, '.'); // split version string to major minor patch let major = digits.next()?.parse::().ok()?; let minor = digits.next()?.parse::().ok()?;