Skip to content

Commit a7d1d1d

Browse files
authored
Merge pull request #2355 from topecongiro/hide-parse-error-format-snippet
Hide parse error in format_snippet()
2 parents b356fc0 + cf4ab38 commit a7d1d1d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ pub fn format_snippet(snippet: &str, config: &Config) -> Option<String> {
540540
let input = Input::Text(snippet.into());
541541
let mut config = config.clone();
542542
config.set().write_mode(config::WriteMode::Plain);
543+
config.set().hide_parse_errors(true);
543544
match format_input(input, &config, Some(&mut out)) {
544545
// `format_input()` returns an empty string on parsing error.
545546
Ok(..) if out.is_empty() && !snippet.is_empty() => None,

0 commit comments

Comments
 (0)