fn maybe_do_cargo_fallback(
        &self,
        toolchain: &Toolchain<'_>,
        binary: &str,
    ) -> Result<Option<Command>> {
        if !toolchain.is_custom() {
            return Ok(None);
        }

        if binary != "cargo" && binary != "cargo.exe" {
            return Ok(None);
        }

        let cargo_path = toolchain.path().join("bin/cargo");
        let cargo_exe_path = toolchain.path().join("bin/cargo.exe");

        if cargo_path.exists() || cargo_exe_path.exists() {
            return Ok(None);
        }

        for fallback in &["nightly", "beta", "stable"] {
            let fallback = self.get_toolchain(fallback, false)?;
            if fallback.exists() {
                let cmd = fallback.create_fallback_command("cargo", toolchain)?;
                return Ok(Some(cmd));
            }
        }

        Ok(None)
    }
// Custom toolchains don't have cargo, so here we detect that situation and
// try to find a different cargo.
Custom toolchains don't have cargo, so here we detect that situation and
try to find a different cargo.
Custom toolchains don ' t have cargo so here we detect that situation and try to find a different cargo .
fn maybe_do_cargo_fallback(
        &self,
        toolchain: &Toolchain<'_>,
        binary: &str,
    ) -> Result<Option<Command>> {
        if !toolchain.is_custom() {
            return Ok(None);
        }
        if binary != "cargo" && binary != "cargo.exe" {
            return Ok(None);
        }
        let cargo_path = toolchain.path().join("bin/cargo");
        let cargo_exe_path = toolchain.path().join("bin/cargo.exe");
        if cargo_path.exists() || cargo_exe_path.exists() {
            return Ok(None);
        }
        for fallback in &["nightly", "beta", "stable"] {
            let fallback = self.get_toolchain(fallback, false)?;
            if fallback.exists() {
                let cmd = fallback.create_fallback_command("cargo", toolchain)?;
                return Ok(Some(cmd));
            }
        }
        Ok(None)
    }
fn maybe_do_cargo_fallback ( & self , toolchain : & Toolchain < ' _ > , binary : & str , ) -> Result < Option < Command > > { if ! toolchain . is_custom ( ) { return Ok ( None ) ; } if binary != " " && binary != " " { return Ok ( None ) ; } let cargo_path = toolchain . path ( ) . join ( " " ) ; let cargo_exe_path = toolchain . path ( ) . join ( " " ) ; if cargo_path . exists ( ) || cargo_exe_path . exists ( ) { return Ok ( None ) ; } for fallback in & [ " " , " " , " " ] { let fallback = self . get_toolchain ( fallback , false ) ? ; if fallback . exists ( ) { let cmd = fallback . create_fallback_command ( " " , toolchain ) ? ; return Ok ( Some ( cmd ) ) ; } } Ok ( None ) }
Custom toolchains don't have cargo, so here we detect that situation and
try to find a different cargo.
Custom toolchains don ' t have cargo so here we detect that situation and try to find a different cargo .
&self
toolchain
&Toolchain<'_>
binary
&str