Skip to content

Commit b7362d9

Browse files
authored
chore: bump rust edition to 2024 (#41)
1 parent 5af3477 commit b7362d9

6 files changed

Lines changed: 19 additions & 21 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "dprint-plugin-exec"
33
version = "0.5.1"
44
authors = ["Alex Zherebtsov <zherebtsovalex@gmail.com>", "David Sherret <dsherret@gmail.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
homepage = "https://github.com/dprint/dprint-plugin-exec"
77
keywords = ["formatting", "formatter", "exec"]
88
license = "MIT"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Use the `rustfmt` binary so you can format stdin.
119119
"exec": {
120120
"cwd": "${configDir}",
121121
"commands": [{
122-
"command": "rustfmt --edition 2021",
122+
"command": "rustfmt --edition 2024",
123123
"exts": ["rs"],
124124
// add the config files for automatic cache invalidation when the rust version or rustfmt config changes
125125
"cacheKeyFiles": [

dprint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"exec": {
55
"cwd": "${configDir}",
66
"commands": [{
7-
"command": "rustfmt --edition 2021 --config imports_granularity=item",
7+
"command": "rustfmt --edition 2024 --config imports_granularity=item",
88
"exts": ["rs"]
99
}]
1010
},

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.82.0"
2+
channel = "1.89.0"
33
components = ["clippy", "rustfmt"]

src/configuration.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
use dprint_core::configuration::get_nullable_value;
2-
use dprint_core::configuration::get_nullable_vec;
3-
use dprint_core::configuration::get_unknown_property_diagnostics;
4-
use dprint_core::configuration::get_value;
51
use dprint_core::configuration::ConfigKeyMap;
62
use dprint_core::configuration::ConfigKeyValue;
73
use dprint_core::configuration::ConfigurationDiagnostic;
84
use dprint_core::configuration::GlobalConfiguration;
9-
use dprint_core::configuration::ResolveConfigurationResult;
105
use dprint_core::configuration::RECOMMENDED_GLOBAL_CONFIGURATION;
6+
use dprint_core::configuration::ResolveConfigurationResult;
7+
use dprint_core::configuration::get_nullable_value;
8+
use dprint_core::configuration::get_nullable_vec;
9+
use dprint_core::configuration::get_unknown_property_diagnostics;
10+
use dprint_core::configuration::get_value;
1111
use globset::GlobMatcher;
1212
use handlebars::Handlebars;
1313
use serde::Serialize;
@@ -416,8 +416,8 @@ fn compute_cache_key_files_hash(cache_key_file_hashes: &[String]) -> Option<Stri
416416
#[cfg(test)]
417417
mod tests {
418418
use super::*;
419-
use dprint_core::configuration::resolve_global_config;
420419
use dprint_core::configuration::ConfigKeyValue;
420+
use dprint_core::configuration::resolve_global_config;
421421
use pretty_assertions::assert_eq;
422422
use serde_json::json;
423423

@@ -635,9 +635,11 @@ mod tests {
635635
result.diagnostics[0].property_name,
636636
"commands[0].cacheKeyFiles"
637637
);
638-
assert!(result.diagnostics[0]
639-
.message
640-
.starts_with("Unable to read file"));
638+
assert!(
639+
result.diagnostics[0]
640+
.message
641+
.starts_with("Unable to read file")
642+
);
641643
}
642644

643645
#[test]

src/handler.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ use std::process::Stdio;
1010
use std::sync::Arc;
1111
use std::time::Duration;
1212

13-
use anyhow::anyhow;
14-
use anyhow::bail;
1513
use anyhow::Error;
1614
use anyhow::Result;
17-
use dprint_core::async_runtime::async_trait;
15+
use anyhow::anyhow;
16+
use anyhow::bail;
1817
use dprint_core::async_runtime::LocalBoxFuture;
18+
use dprint_core::async_runtime::async_trait;
1919
use dprint_core::configuration::ConfigKeyMap;
2020
use dprint_core::configuration::GlobalConfiguration;
2121
use dprint_core::plugins::AsyncPluginHandler;
@@ -156,11 +156,7 @@ pub async fn format_bytes(
156156
end -= 1;
157157
}
158158

159-
if end < start {
160-
0
161-
} else {
162-
end - start
163-
}
159+
if end < start { 0 } else { end - start }
164160
}
165161

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

0 commit comments

Comments
 (0)