Merge pull request #2355 from topecongiro/hide-parse-error-format-snippet
Hide parse error in format_snippet()
This commit is contained in:
commit
a7d1d1da0e
@ -540,6 +540,7 @@ pub fn format_snippet(snippet: &str, config: &Config) -> Option<String> {
|
||||
let input = Input::Text(snippet.into());
|
||||
let mut config = config.clone();
|
||||
config.set().write_mode(config::WriteMode::Plain);
|
||||
config.set().hide_parse_errors(true);
|
||||
match format_input(input, &config, Some(&mut out)) {
|
||||
// `format_input()` returns an empty string on parsing error.
|
||||
Ok(..) if out.is_empty() && !snippet.is_empty() => None,
|
||||
|
Loading…
Reference in New Issue
Block a user