fn remove_tempdirs() -> Result<(), io::Error> {
    // NOTE: hardcodes that `tempfile::tempdir()` uses `std::env::temp_dir`.
    for entry in std::fs::read_dir(std::env::temp_dir())? {
        let entry = entry?;
        if !entry.metadata()?.is_dir() {
            continue;
        }

        if let Some(dir_name) = entry.path().file_name() {
            if dir_name.to_string_lossy().starts_with(TEMPDIR_PREFIX) {
                fs::remove_dir_all(entry.path())?;
            }
        }
    }

    Ok(())
}
/// Sometimes, when the server hits a hard crash or a build thread panics,
/// rustwide_builder won't actually remove the temporary directories it creates.
/// Remove them now to avoid running out of disk space.
Sometimes, when the server hits a hard crash or a build thread panics,
rustwide_builder won't actually remove the temporary directories it creates.
Remove them now to avoid running out of disk space.
Sometimes when the server hits a hard crash or a build thread panics rustwide_builder won ' t actually remove the temporary directories it creates . Remove them now to avoid running out of disk space .
fn remove_tempdirs() -> Result<(), io::Error> {
    // NOTE: hardcodes that `tempfile::tempdir()` uses `std::env::temp_dir`.
    for entry in std::fs::read_dir(std::env::temp_dir())? {
        let entry = entry?;
        if !entry.metadata()?.is_dir() {
            continue;
        }
        if let Some(dir_name) = entry.path().file_name() {
            if dir_name.to_string_lossy().starts_with(TEMPDIR_PREFIX) {
                fs::remove_dir_all(entry.path())?;
            }
        }
    }
    Ok(())
}
fn remove_tempdirs ( ) -> Result < ( ) , io :: Error > { // NOTE: hardcodes that `tempfile::tempdir()` uses `std::env::temp_dir`. for entry in std :: fs :: read_dir ( std :: env :: temp_dir ( ) ) ? { let entry = entry ? ; if ! entry . metadata ( ) ? . is_dir ( ) { continue ; } if let Some ( dir_name ) = entry . path ( ) . file_name ( ) { if dir_name . to_string_lossy ( ) . starts_with ( TEMPDIR_PREFIX ) { fs :: remove_dir_all ( entry . path ( ) ) ? ; } } } Ok ( ( ) ) }
Sometimes, when the server hits a hard crash or a build thread panics,
rustwide_builder won't actually remove the temporary directories it creates.
Sometimes when the server hits a hard crash or a build thread panics rustwide_builder won ' t actually remove the temporary directories it creates .