Skip to content

Commit 6f72b7d

Browse files
committed
chore: address lint warnings
1 parent 196e05b commit 6f72b7d

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎src/main.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod cli;
1919
use std::{
2020
env, fs,
2121
io::{self, IsTerminal, Read, Write},
22-
path::PathBuf,
22+
path::{Path, PathBuf},
2323
thread,
2424
};
2525

@@ -115,10 +115,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
115115
unreachable!();
116116
};
117117

118-
let mut config = FormatterConfiguration::default();
118+
let mut config = FormatterConfiguration {
119+
safe: use_safe_mode,
120+
reorder_code: do_reorder_code,
121+
..Default::default()
122+
};
119123

120-
config.safe = use_safe_mode;
121-
config.reorder_code = do_reorder_code;
122124
if let Some(quote_style) = quote_style {
123125
config.quote_style = quote_style;
124126
}
@@ -317,7 +319,7 @@ fn format_one_file(
317319
/// incorrectly override `.editorconfig`.
318320
fn config_apply_editorconfig_then_cli_overrides(
319321
config: &mut FormatterConfiguration,
320-
config_path: &PathBuf,
322+
config_path: &Path,
321323
config_overrides: FormatterConfigOverrides,
322324
) {
323325
gdscript_formatter::editorconfig::apply_editorconfig_to_formatter_config(config, config_path);

‎tests/cli_tests.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ fn stdin_and_file_modes_apply_editorconfig_and_cli_overrides() {
6767
.wait_with_output()
6868
.expect("should collect formatter output");
6969
assert!(stdin_output.status.success());
70-
assert_eq!(String::from_utf8(stdin_output.stdout).unwrap(), expected);
70+
assert_eq!(
71+
String::from_utf8(stdin_output.stdout).expect("stdin output should be valid UTF-8"),
72+
expected,
73+
);
7174

7275
let input_path = directory.join("input.gd");
7376
fs::write(&input_path, input).expect("should write input file");
@@ -88,7 +91,10 @@ fn stdin_and_file_modes_apply_editorconfig_and_cli_overrides() {
8891
.output()
8992
.expect("should format file");
9093
assert!(file_output.status.success());
91-
assert_eq!(String::from_utf8(file_output.stdout).unwrap(), expected);
94+
assert_eq!(
95+
String::from_utf8(file_output.stdout).expect("file output should be valid UTF-8"),
96+
expected,
97+
);
9298

9399
fs::remove_dir_all(directory).expect("should remove temporary test directory");
94100
}

0 commit comments

Comments
 (0)