summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-06-06 18:42:12 +0200
committerGitHub <noreply@github.com>2021-06-06 18:42:12 +0200
commit3b220c64f615a4e18346e8a1c07ad7b1aae9fcc6 (patch)
tree9329ed9e4d9881c1ac166aef65ea2821fc121761 /cli/tools/fmt.rs
parenta66f327250d9df77816e80e7d411b232f8b08b11 (diff)
chore: upgrade crates (#10867)
* deno_doc - 0.5.0 * deno_lint - 0.6.0 * dprint-plugin-typescript - 0.46.0 * dprint-plugin-markdown - 0.8.0 * dprint-plugin-json - 0.12.0 * swc_bundler - 0.37.4 * swc_ecmascript - 0.36.0
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 869403f07..ac9af0292 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -101,7 +101,7 @@ fn format_markdown(
dprint_plugin_markdown::format_text(
&file_text,
&md_config,
- Box::new(move |tag, text, line_width| {
+ move |tag, text, line_width| {
let tag = tag.to_lowercase();
if matches!(
tag.as_str(),
@@ -140,8 +140,9 @@ fn format_markdown(
} else {
Ok(text.to_string())
}
- }),
+ },
)
+ .map_err(|e| e.to_string())
}
/// Formats JSON and JSONC using the rules provided by .deno()
@@ -150,6 +151,7 @@ fn format_markdown(
fn format_json(file_text: &str) -> Result<String, String> {
let json_config = get_json_config();
dprint_plugin_json::format_text(&file_text, &json_config)
+ .map_err(|e| e.to_string())
}
/// Formats a single TS, TSX, JS, JSX, JSONC, JSON, or MD file.
@@ -165,6 +167,7 @@ pub fn format_file(
format_json(&file_text)
} else {
dprint_plugin_typescript::format_text(&file_path, &file_text, &config)
+ .map_err(|e| e.to_string())
}
}