mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Add simplistic config validation
This commit is contained in:
parent
6d7055e322
commit
b90df7997d
@ -571,6 +571,9 @@ impl Config {
|
||||
None => tracing::info!("Invalid snippet {}", name),
|
||||
}
|
||||
}
|
||||
|
||||
self.validate(&mut errors);
|
||||
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
@ -578,6 +581,16 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
fn validate(&self, error_sink: &mut Vec<(String, serde_json::Error)>) {
|
||||
use serde::de::Error;
|
||||
if self.data.checkOnSave_command.is_empty() {
|
||||
error_sink.push((
|
||||
"/checkOnSave/command".to_string(),
|
||||
serde_json::Error::custom("expected a non-empty string"),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn json_schema() -> serde_json::Value {
|
||||
ConfigData::json_schema()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user