Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "dprint-plugin-exec"
version = "0.5.1"
authors = ["Alex Zherebtsov <[email protected]>", "David Sherret <[email protected]>"]
edition = "2021"
edition = "2024"
homepage = "https://github.com/dprint/dprint-plugin-exec"
keywords = ["formatting", "formatter", "exec"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Use the `rustfmt` binary so you can format stdin.
"exec": {
"cwd": "${configDir}",
"commands": [{
"command": "rustfmt --edition 2021",
"command": "rustfmt --edition 2024",
"exts": ["rs"],
// add the config files for automatic cache invalidation when the rust version or rustfmt config changes
"cacheKeyFiles": [
Expand Down
2 changes: 1 addition & 1 deletion dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"exec": {
"cwd": "${configDir}",
"commands": [{
"command": "rustfmt --edition 2021 --config imports_granularity=item",
"command": "rustfmt --edition 2024 --config imports_granularity=item",
"exts": ["rs"]
}]
},
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.82.0"
channel = "1.89.0"
components = ["clippy", "rustfmt"]
20 changes: 11 additions & 9 deletions src/configuration.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use dprint_core::configuration::get_nullable_value;
use dprint_core::configuration::get_nullable_vec;
use dprint_core::configuration::get_unknown_property_diagnostics;
use dprint_core::configuration::get_value;
use dprint_core::configuration::ConfigKeyMap;
use dprint_core::configuration::ConfigKeyValue;
use dprint_core::configuration::ConfigurationDiagnostic;
use dprint_core::configuration::GlobalConfiguration;
use dprint_core::configuration::ResolveConfigurationResult;
use dprint_core::configuration::RECOMMENDED_GLOBAL_CONFIGURATION;
use dprint_core::configuration::ResolveConfigurationResult;
use dprint_core::configuration::get_nullable_value;
use dprint_core::configuration::get_nullable_vec;
use dprint_core::configuration::get_unknown_property_diagnostics;
use dprint_core::configuration::get_value;
use globset::GlobMatcher;
use handlebars::Handlebars;
use serde::Serialize;
Expand Down Expand Up @@ -416,8 +416,8 @@ fn compute_cache_key_files_hash(cache_key_file_hashes: &[String]) -> Option<Stri
#[cfg(test)]
mod tests {
use super::*;
use dprint_core::configuration::resolve_global_config;
use dprint_core::configuration::ConfigKeyValue;
use dprint_core::configuration::resolve_global_config;
use pretty_assertions::assert_eq;
use serde_json::json;

Expand Down Expand Up @@ -635,9 +635,11 @@ mod tests {
result.diagnostics[0].property_name,
"commands[0].cacheKeyFiles"
);
assert!(result.diagnostics[0]
.message
.starts_with("Unable to read file"));
assert!(
result.diagnostics[0]
.message
.starts_with("Unable to read file")
);
}

#[test]
Expand Down
12 changes: 4 additions & 8 deletions src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use std::process::Stdio;
use std::sync::Arc;
use std::time::Duration;

use anyhow::anyhow;
use anyhow::bail;
use anyhow::Error;
use anyhow::Result;
use dprint_core::async_runtime::async_trait;
use anyhow::anyhow;
use anyhow::bail;
use dprint_core::async_runtime::LocalBoxFuture;
use dprint_core::async_runtime::async_trait;
use dprint_core::configuration::ConfigKeyMap;
use dprint_core::configuration::GlobalConfiguration;
use dprint_core::plugins::AsyncPluginHandler;
Expand Down Expand Up @@ -156,11 +156,7 @@ pub async fn format_bytes(
end -= 1;
}

if end < start {
0
} else {
end - start
}
if end < start { 0 } else { end - start }
}

let mut file_bytes: Cow<Vec<u8>> = Cow::Borrowed(&original_file_bytes);
Expand Down
Loading