aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/proc_macro_api')
-rw-r--r--crates/proc_macro_api/src/version.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/proc_macro_api/src/version.rs b/crates/proc_macro_api/src/version.rs
index 28a4ac086..434decc7e 100644
--- a/crates/proc_macro_api/src/version.rs
+++ b/crates/proc_macro_api/src/version.rs
@@ -28,23 +28,23 @@ pub fn read_dylib_info(dylib_path: &Path) -> io::Result<RustCInfo> {
28 28
29 let ver_str = read_version(dylib_path)?; 29 let ver_str = read_version(dylib_path)?;
30 let mut items = ver_str.split_whitespace(); 30 let mut items = ver_str.split_whitespace();
31 let tag = items.next().ok_or(err!("version format error"))?; 31 let tag = items.next().ok_or_else(|| err!("version format error"))?;
32 if tag != "rustc" { 32 if tag != "rustc" {
33 return Err(err!("version format error (No rustc tag)")); 33 return Err(err!("version format error (No rustc tag)"));
34 } 34 }
35 35
36 let version_part = items.next().ok_or(err!("no version string"))?; 36 let version_part = items.next().ok_or_else(|| err!("no version string"))?;
37 let mut version_parts = version_part.split('-'); 37 let mut version_parts = version_part.split('-');
38 let version = version_parts.next().ok_or(err!("no version"))?; 38 let version = version_parts.next().ok_or_else(|| err!("no version"))?;
39 let channel = version_parts.next().unwrap_or_default().to_string(); 39 let channel = version_parts.next().unwrap_or_default().to_string();
40 40
41 let commit = items.next().ok_or(err!("no commit info"))?; 41 let commit = items.next().ok_or_else(|| err!("no commit info"))?;
42 // remove ( 42 // remove (
43 if commit.len() == 0 { 43 if commit.len() == 0 {
44 return Err(err!("commit format error")); 44 return Err(err!("commit format error"));
45 } 45 }
46 let commit = commit[1..].to_string(); 46 let commit = commit[1..].to_string();
47 let date = items.next().ok_or(err!("no date info"))?; 47 let date = items.next().ok_or_else(|| err!("no date info"))?;
48 // remove ) 48 // remove )
49 if date.len() == 0 { 49 if date.len() == 0 {
50 return Err(err!("date format error")); 50 return Err(err!("date format error"));