clippy --fix
This commit is contained in:
		@@ -3,7 +3,7 @@ use std::process::{Command, Stdio};
 | 
			
		||||
 | 
			
		||||
fn search_file<T: AsRef<str>, P: AsRef<str>>(start: T, name: P) -> Option<PathBuf> {
 | 
			
		||||
    let start_path = PathBuf::from(start.as_ref()).canonicalize().ok();
 | 
			
		||||
    let mut path = start_path.as_ref().map(|x| x.as_path());
 | 
			
		||||
    let mut path = start_path.as_deref();
 | 
			
		||||
    while let Some(some_path) = path {
 | 
			
		||||
        let file_path = some_path.join(name.as_ref());
 | 
			
		||||
        if file_path.exists() {
 | 
			
		||||
@@ -18,10 +18,8 @@ fn get_desired_capnp_version_string() -> String {
 | 
			
		||||
    let capnp_path = search_file(env!("CARGO_MANIFEST_DIR"), ".capnp_version")
 | 
			
		||||
        .expect("should find .capnp_version file");
 | 
			
		||||
    std::fs::read_to_string(&capnp_path)
 | 
			
		||||
        .expect(&format!(
 | 
			
		||||
            "can't read .capnp_version file here: {:?}",
 | 
			
		||||
            capnp_path
 | 
			
		||||
        ))
 | 
			
		||||
        .unwrap_or_else(|_| panic!("can't read .capnp_version file here: {:?}",
 | 
			
		||||
            capnp_path))
 | 
			
		||||
        .trim()
 | 
			
		||||
        .to_owned()
 | 
			
		||||
}
 | 
			
		||||
@@ -47,10 +45,8 @@ fn get_desired_protoc_version_string() -> String {
 | 
			
		||||
    let protoc_path = search_file(env!("CARGO_MANIFEST_DIR"), ".protoc_version")
 | 
			
		||||
        .expect("should find .protoc_version file");
 | 
			
		||||
    std::fs::read_to_string(&protoc_path)
 | 
			
		||||
        .expect(&format!(
 | 
			
		||||
            "can't read .protoc_version file here: {:?}",
 | 
			
		||||
            protoc_path
 | 
			
		||||
        ))
 | 
			
		||||
        .unwrap_or_else(|_| panic!("can't read .protoc_version file here: {:?}",
 | 
			
		||||
            protoc_path))
 | 
			
		||||
        .trim()
 | 
			
		||||
        .to_owned()
 | 
			
		||||
}
 | 
			
		||||
@@ -80,10 +76,10 @@ fn main() {
 | 
			
		||||
 | 
			
		||||
    // Check capnp version
 | 
			
		||||
    let desired_capnp_major_version =
 | 
			
		||||
        usize::from_str_radix(desired_capnp_version_string.split_once(".").unwrap().0, 10)
 | 
			
		||||
        usize::from_str_radix(desired_capnp_version_string.split_once('.').unwrap().0, 10)
 | 
			
		||||
            .expect("should be valid int");
 | 
			
		||||
 | 
			
		||||
    if usize::from_str_radix(capnp_version_string.split_once(".").unwrap().0, 10)
 | 
			
		||||
    if usize::from_str_radix(capnp_version_string.split_once('.').unwrap().0, 10)
 | 
			
		||||
        .expect("should be valid int")
 | 
			
		||||
        != desired_capnp_major_version
 | 
			
		||||
    {
 | 
			
		||||
@@ -100,9 +96,9 @@ fn main() {
 | 
			
		||||
 | 
			
		||||
    // Check protoc version
 | 
			
		||||
    let desired_protoc_major_version =
 | 
			
		||||
        usize::from_str_radix(desired_protoc_version_string.split_once(".").unwrap().0, 10)
 | 
			
		||||
        usize::from_str_radix(desired_protoc_version_string.split_once('.').unwrap().0, 10)
 | 
			
		||||
            .expect("should be valid int");
 | 
			
		||||
    if usize::from_str_radix(protoc_version_string.split_once(".").unwrap().0, 10)
 | 
			
		||||
    if usize::from_str_radix(protoc_version_string.split_once('.').unwrap().0, 10)
 | 
			
		||||
        .expect("should be valid int")
 | 
			
		||||
        < desired_protoc_major_version
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user