Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gamebox authored and lpil committed Apr 28, 2020
1 parent 18c6768 commit e8fa378
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ pub enum Error {
},

Format {
path: PathBuf
}
path: PathBuf,
},
}

#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -1054,10 +1054,8 @@ but it cannot be found.",
),
};
write_project(buffer, diagnostic);
},
Error::Format {
path
} => {
}
Error::Format { path } => {
let diagnostic = ProjectErrorDiagnostic {
title: "File needs formatting".to_string(),
label: format!("{}", path.to_str().unwrap()),
Expand Down
20 changes: 14 additions & 6 deletions src/format/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,26 @@ pub fn format_files(files: Vec<String>, check: bool) -> Result<(), Error> {
match format_file(&path, check) {
Ok(_) => (),
Err(e) => match e {
Error::Format {..} => { formatting_errors.push(e); },
_ => { return Err(e); }
}
Error::Format { .. } => {
formatting_errors.push(e);
}
_ => {
return Err(e);
}
},
}
}
} else {
match format_file(&path, check) {
Ok(_) => (),
Err(e) => match e {
Error::Format {..} => { formatting_errors.push(e); },
_ => { return Err(e); }
}
Error::Format { .. } => {
formatting_errors.push(e);
}
_ => {
return Err(e);
}
},
}
}
}
Expand Down

0 comments on commit e8fa378

Please sign in to comment.