From cad617bba054334e2172b9ef54f2ed82c6067794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 15 Mar 2021 10:15:08 +0100 Subject: 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 --- crates/proc_macro_api/src/version.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 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 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 { } let version_part = items.next().ok_or(err!("no version string"))?; - let mut version_parts = version_part.split("-"); + let mut version_parts = version_part.split('-'); let version = version_parts.next().ok_or(err!("no version"))?; let channel = version_parts.next().unwrap_or_default().to_string(); @@ -51,7 +51,7 @@ pub(crate) fn read_info(dylib_path: &Path) -> io::Result { let date = date[0..date.len() - 2].to_string(); let version_numbers = version - .split(".") + .split('.') .map(|it| it.parse::()) .collect::, _>>() .map_err(|_| err!("version number error"))?; -- cgit v1.2.3