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
This commit is contained in:
@@ -33,7 +33,7 @@ pub(crate) fn read_info(dylib_path: &Path) -> io::Result<RustCInfo> {
|
||||
}
|
||||
|
||||
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<RustCInfo> {
|
||||
let date = date[0..date.len() - 2].to_string();
|
||||
|
||||
let version_numbers = version
|
||||
.split(".")
|
||||
.split('.')
|
||||
.map(|it| it.parse::<usize>())
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(|_| err!("version number error"))?;
|
||||
|
||||
Reference in New Issue
Block a user