From e3ce88f6f25901b1d33fbc5f931a9d8f90b9e2b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 18 Jun 2021 14:40:51 +0300 Subject: Minor clippy perf fixes --- crates/proc_macro_api/src/version.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/proc_macro_api') 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 { let ver_str = read_version(dylib_path)?; let mut items = ver_str.split_whitespace(); - let tag = items.next().ok_or(err!("version format error"))?; + let tag = items.next().ok_or_else(|| err!("version format error"))?; if tag != "rustc" { return Err(err!("version format error (No rustc tag)")); } - let version_part = items.next().ok_or(err!("no version string"))?; + let version_part = items.next().ok_or_else(|| err!("no version string"))?; let mut version_parts = version_part.split('-'); - let version = version_parts.next().ok_or(err!("no version"))?; + let version = version_parts.next().ok_or_else(|| err!("no version"))?; let channel = version_parts.next().unwrap_or_default().to_string(); - let commit = items.next().ok_or(err!("no commit info"))?; + let commit = items.next().ok_or_else(|| err!("no commit info"))?; // remove ( if commit.len() == 0 { return Err(err!("commit format error")); } let commit = commit[1..].to_string(); - let date = items.next().ok_or(err!("no date info"))?; + let date = items.next().ok_or_else(|| err!("no date info"))?; // remove ) if date.len() == 0 { return Err(err!("date format error")); -- cgit v1.2.3