From 0f119b51c0e7f7e5f40ddb88f4275a469f5fb158 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 12 May 2022 10:36:07 +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 c2bd16e..fb9c15f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -953,8 +953,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()?;