summaryrefslogtreecommitdiffstats
path: root/src/parse.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-07-05 22:29:30 -0400
committerDan Davison <dandavison7@gmail.com>2020-07-05 22:30:52 -0400
commita0a2ad8d301de3f979a9d7f5c2fc509f1a0efb62 (patch)
treedfb45c3f15cb0bdad8a261e82bf648bcfae328d9 /src/parse.rs
parent6a94050a9fb9123668edc1bbe371af20dea62d2a (diff)
Simplify regex
Diffstat (limited to 'src/parse.rs')
-rw-r--r--src/parse.rs19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/parse.rs b/src/parse.rs
index 006e7464..df818f1f 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -90,23 +90,8 @@ pub fn get_file_change_description_from_file_paths(
}
lazy_static! {
- static ref HUNK_METADATA_REGEXP: Regex = Regex::new(
- r"(?x)
-@+ # Start hunk header
-\ # One space
-(?P<lns> # Start file coordinates
- ( # Start file coordinate
- [-+] # - or +
- \d+ # A digit
- (?:,\d+)? # Optionally followed by a comma and another digit
- \ # One space
- ){2,4} #
-) #
-@+ # End hunk header
-(?P<cf>.*\s?) # Code fragment
-"
- )
- .unwrap();
+ static ref HUNK_METADATA_REGEXP: Regex =
+ Regex::new(r"@+ (?P<lns>[^@]+)@+(?P<cf>.*\s?)").unwrap();
}
lazy_static! {