- if let Some(files) = get_modified_rs_files(build) {
- for file in files {
- println!("formatting modified file {file}");
- ignore_fmt.add(&format!("/{file}")).expect(&file);
+ match get_modified_rs_files(build) {
+ Ok(Some(files)) => {
+ for file in files {
+ println!("formatting modified file {file}");
+ ignore_fmt.add(&format!("/{file}")).expect(&file);
+ }
+ }
+ Ok(None) => {}
+ Err(err) => {
+ println!(
+ "WARN: Something went wrong when running git commands:\n{err}\n\
+ Falling back to formatting all files."
+ );
+ // Something went wrong when getting the version. Just format all the files.
+ paths.push(".".into());