pub fn backup_original_cargo_files(project_dir: &PathBuf) -> Result<()> {
    let paths = CargoPaths::new(project_dir);

    copy(&paths.cargo_toml, &paths.toml_backup).with_context(|| {
        format!(
            "Could not backup {:?} to {:?}",
            &paths.cargo_toml, &paths.toml_backup
        )
    })?;

    if paths.cargo_lock.exists() {
        rename(&paths.cargo_lock, &paths.lock_backup).with_context(|| {
            format!(
                "Could not backup {:?} to {:?}",
                &paths.cargo_lock, &paths.lock_backup
            )
        })?;
    }

    Ok(())
}
/// Saves copies of the orignal Cargo.toml and Cargo.lock files in the project directory.
///
/// * `project_dir` - The path to the RTIC project
Saves copies of the orignal Cargo.toml and Cargo.lock files in the project directory.
`project_dir` - The path to the RTIC project
Saves copies of the orignal Cargo . toml and Cargo . lock files in the project directory . ` project_dir ` - The path to the RTIC project
pub fn backup_original_cargo_files(project_dir: &PathBuf) -> Result<()> {
    let paths = CargoPaths::new(project_dir);
    copy(&paths.cargo_toml, &paths.toml_backup).with_context(|| {
        format!(
            "Could not backup {:?} to {:?}",
            &paths.cargo_toml, &paths.toml_backup
        )
    })?;
    if paths.cargo_lock.exists() {
        rename(&paths.cargo_lock, &paths.lock_backup).with_context(|| {
            format!(
                "Could not backup {:?} to {:?}",
                &paths.cargo_lock, &paths.lock_backup
            )
        })?;
    }
    Ok(())
}
pub fn backup_original_cargo_files ( project_dir : & PathBuf ) -> Result < ( ) > { let paths = CargoPaths :: new ( project_dir ) ; copy ( & paths . cargo_toml , & paths . toml_backup ) . with_context ( | | { format ! ( " " paths cargo_toml paths toml_backup ) } ) ? ; if paths . cargo_lock . exists ( ) { rename ( & paths . cargo_lock , & paths . lock_backup ) . with_context ( | | { format ! ( " " paths cargo_lock paths lock_backup ) } ) ? ; } Ok ( ( ) ) }
Saves copies of the orignal Cargo.toml and Cargo.lock files in the project directory.
Saves copies of the orignal Cargo . toml and Cargo . lock files in the project directory .
project_dir
&PathBuf
project_dir
&PathBuf