Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 22ade3d

Browse files
committed
Remove catch_unwind let rustfmt.format handle this properly
1 parent dede5d5 commit 22ade3d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/actions/hover.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -782,19 +782,15 @@ fn format_object(rustfmt: Rustfmt, fmt_config: &FmtConfig, the_type: String) ->
782782
format!("{}{{}}", trimmed)
783783
};
784784

785-
let formatted = match std::panic::catch_unwind(|| rustfmt.format(object.clone(), config)) {
786-
Ok(Ok(lines)) => match lines.rfind('{') {
785+
let formatted = match rustfmt.format(object.clone(), config) {
786+
Ok(lines) => match lines.rfind('{') {
787787
Some(pos) => lines[0..pos].into(),
788788
None => lines,
789789
},
790-
Ok(Err(e)) => {
790+
Err(e) => {
791791
error!("format_object: error: {:?}, input: {:?}", e, object);
792792
trimmed.to_string()
793793
}
794-
Err(_) => {
795-
error!("format_object: rustfmt panicked on input: {:?}", object);
796-
trimmed.to_string()
797-
}
798794
};
799795

800796
// If it's a tuple, remove the trailing ';' and hide non-pub components

0 commit comments

Comments
 (0)