skip formatting if no files have been modified

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-09-09 21:23:06 +03:00
parent 35ce85e0fd
commit 0a7f9e2134

View File

@ -200,6 +200,11 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
adjective = Some("modified");
match get_modified_rs_files(build) {
Ok(Some(files)) => {
if files.is_empty() {
println!("fmt info: No modified files detected for formatting.");
return;
}
for file in files {
override_builder.add(&format!("/{file}")).expect(&file);
}