[librsvg: 5/7] Appease clippy by handling all the cases of BufReader.lines()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 5/7] Appease clippy by handling all the cases of BufReader.lines()
- Date: Tue, 18 May 2021 01:08:38 +0000 (UTC)
commit 010a9a461b43b99118fdf2d09d397e92e2dca4d8
Author: Federico Mena Quintero <federico gnome org>
Date: Mon May 17 13:13:56 2021 -0500
Appease clippy by handling all the cases of BufReader.lines()
build.rs | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/build.rs b/build.rs
index 41d5a8ac..ac08a9bb 100644
--- a/build.rs
+++ b/build.rs
@@ -78,20 +78,24 @@ fn write_version() {
let micro_regex = Regex::new(r#"^m4_define\(\[rsvg_micro_version\],\[(\d+)\]\)"#).unwrap();
for line in BufReader::new(file).lines() {
- if let Ok(line) = line {
- if let Some(nums) = major_regex.captures(&line) {
- major = Some(String::from(
- nums.get(1).expect("major_regex matched once").as_str(),
- ));
- } else if let Some(nums) = minor_regex.captures(&line) {
- minor = Some(String::from(
- nums.get(1).expect("minor_regex matched once").as_str(),
- ));
- } else if let Some(nums) = micro_regex.captures(&line) {
- micro = Some(String::from(
- nums.get(1).expect("micro_regex matched once").as_str(),
- ));
+ match line {
+ Ok(line) => {
+ if let Some(nums) = major_regex.captures(&line) {
+ major = Some(String::from(
+ nums.get(1).expect("major_regex matched once").as_str(),
+ ));
+ } else if let Some(nums) = minor_regex.captures(&line) {
+ minor = Some(String::from(
+ nums.get(1).expect("minor_regex matched once").as_str(),
+ ));
+ } else if let Some(nums) = micro_regex.captures(&line) {
+ micro = Some(String::from(
+ nums.get(1).expect("micro_regex matched once").as_str(),
+ ));
+ }
}
+
+ Err(e) => panic!("could not parse version from configure.ac: {}", e),
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]