From a19ced85921a17a42ad2d76b744ba765f1038341 Mon Sep 17 00:00:00 2001 From: Luke-zhang-04 Date: Thu, 5 Nov 2020 11:28:46 -0500 Subject: [PATCH] refactor: simplify regex in package parsers Signed-off-by: Luke-zhang-04 --- src/onefetch/deps/package_parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onefetch/deps/package_parser.rs b/src/onefetch/deps/package_parser.rs index 501e6b29f..6715ccc29 100644 --- a/src/onefetch/deps/package_parser.rs +++ b/src/onefetch/deps/package_parser.rs @@ -20,7 +20,7 @@ pub fn npm(contents: &str) -> Result { } pub fn pip(contents: &str) -> Result { - let count = Regex::new(r"(^[A-z]+)|(\n[A-z]+)")?.find_iter(contents).count(); + let count = Regex::new(r"(^|\n)[A-z]+")?.find_iter(contents).count(); Ok(count) }