Skip to content

Commit f4bc494

Browse files
calebcartwrighttopecongiro
authored andcommitted
add --offline mode fallback to cargo fmt (rust-lang#3813)
1 parent 72e44c4 commit f4bc494

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cargo-fmt/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,16 @@ fn get_cargo_metadata(
519519
if let Some(manifest_path) = manifest_path {
520520
cmd.manifest_path(manifest_path);
521521
}
522+
522523
match cmd.exec() {
523524
Ok(metadata) => Ok(metadata),
524-
Err(error) => Err(io::Error::new(io::ErrorKind::Other, error.to_string())),
525+
Err(_) => {
526+
cmd.other_options(&[String::from("--offline")]);
527+
match cmd.exec() {
528+
Ok(metadata) => Ok(metadata),
529+
Err(error) => Err(io::Error::new(io::ErrorKind::Other, error.to_string())),
530+
}
531+
}
525532
}
526533
}
527534

0 commit comments

Comments
 (0)