Skip to content

Commit

Permalink
fix: follow up dprint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Dec 1, 2023
1 parent 04463cc commit f3093b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/ruff_fmt_dprint/src/format_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn format_text(text: &str, file_path: &Path, config: &Configuration) -> Form
let config = config.clone().with_path(file_path.to_string_lossy().to_string());
format_module_source(text, config.into())
.map_err(|err| err.into())
.map(|result| (result.as_code() != text).then_some(result.into_code()))
.map(|result| (result.as_code() != text).then_some(result.into_code().into_bytes()))
}

#[cfg(test)]
Expand Down
8 changes: 3 additions & 5 deletions crates/ruff_fmt_dprint/src/wasm_plugin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::path::Path;

use dprint_core::configuration::ConfigKeyMap;
use dprint_core::configuration::GlobalConfiguration;
use dprint_core::configuration::ResolveConfigurationResult;
Expand Down Expand Up @@ -60,11 +58,11 @@ impl SyncPluginHandler<Configuration> for RuffFmtWasmPlugin {
fn format(
&mut self,
file_path: &std::path::Path,
file_text: &str,
file_bytes: Vec<u8>,
config: &Configuration,
mut _format_with_host: impl FnMut(&Path, String, &ConfigKeyMap) -> FormatResult,
_format_with_host: impl FnMut(&std::path::Path, Vec<u8>, &ConfigKeyMap) -> FormatResult,
) -> FormatResult {
format_text(file_text, file_path, config)
format_text(&String::from_utf8_lossy(&file_bytes), file_path, config)
}
}

Expand Down

0 comments on commit f3093b1

Please sign in to comment.