aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_api/src
diff options
context:
space:
mode:
authorMatthias Krüger <[email protected]>2021-03-15 09:15:08 +0000
committerMatthias Krüger <[email protected]>2021-03-15 09:19:59 +0000
commitcad617bba054334e2172b9ef54f2ed82c6067794 (patch)
tree3c124ef8606b985353de946245498babe5d7c6a0 /crates/proc_macro_api/src
parentde360275416ca095102f2b17d6ca1de3bd091fdb (diff)
some clippy::performance fixes
use vec![] instead of Vec::new() + push() avoid redundant clones use chars instead of &str for single char patterns in ends_with() and starts_with() allocate some Vecs with capacity to avoid unneccessary resizing
Diffstat (limited to 'crates/proc_macro_api/src')
-rw-r--r--crates/proc_macro_api/src/version.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/proc_macro_api/src/version.rs b/crates/proc_macro_api/src/version.rs
index 11a7fb59a..b903658fb 100644
--- a/crates/proc_macro_api/src/version.rs
+++ b/crates/proc_macro_api/src/version.rs
@@ -33,7 +33,7 @@ pub(crate) fn read_info(dylib_path: &Path) -> io::Result<RustCInfo> {
33 } 33 }
34 34
35 let version_part = items.next().ok_or(err!("no version string"))?; 35 let version_part = items.next().ok_or(err!("no version string"))?;
36 let mut version_parts = version_part.split("-"); 36 let mut version_parts = version_part.split('-');
37 let version = version_parts.next().ok_or(err!("no version"))?; 37 let version = version_parts.next().ok_or(err!("no version"))?;
38 let channel = version_parts.next().unwrap_or_default().to_string(); 38 let channel = version_parts.next().unwrap_or_default().to_string();
39 39
@@ -51,7 +51,7 @@ pub(crate) fn read_info(dylib_path: &Path) -> io::Result<RustCInfo> {
51 let date = date[0..date.len() - 2].to_string(); 51 let date = date[0..date.len() - 2].to_string();
52 52
53 let version_numbers = version 53 let version_numbers = version
54 .split(".") 54 .split('.')
55 .map(|it| it.parse::<usize>()) 55 .map(|it| it.parse::<usize>())
56 .collect::<Result<Vec<_>, _>>() 56 .collect::<Result<Vec<_>, _>>()
57 .map_err(|_| err!("version number error"))?; 57 .map_err(|_| err!("version number error"))?;