mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-30 23:27:24 +00:00
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:
parent
de36027541
commit
cad617bba0
9 changed files with 13 additions and 19 deletions
|
@ -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"))?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue