Skip to content

Commit

Permalink
fix(cli): simplify file modified check
Browse files Browse the repository at this point in the history
  • Loading branch information
hougesen committed Feb 24, 2025
1 parent 696ab47 commit 77bc36b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [Unreleased](https://github.com/hougesen/mdsf/compare/v0.5.2...HEAD)

- chore: add package manager to sleek, sqlfmt and typstyle [`#726`](https://github.com/hougesen/mdsf/pull/726)
- feat(cli): add support for pasfmt [`#725`](https://github.com/hougesen/mdsf/pull/725)
- feat(cli): add support for mago [`#724`](https://github.com/hougesen/mdsf/pull/724)
- feat(cli): add support for slim-lint [`#723`](https://github.com/hougesen/mdsf/pull/723)
Expand Down
9 changes: 1 addition & 8 deletions mdsf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ fn format_file(
) -> (bool, String) {
let mut output = String::with_capacity(input.len() + 128);

let mut modified = false;

let mut lines = input.lines().enumerate();

while let Some((line_index, line)) = lines.next() {
Expand Down Expand Up @@ -124,10 +122,6 @@ fn format_file(
output.push_str(&formatted);

output.push_str(&format!("\n{indentation}```"));

if formatted != code_snippet {
modified = true;
}
} else {
output.push_str(line);
output.push_str(&code_snippet);
Expand Down Expand Up @@ -158,10 +152,9 @@ fn format_file(
&output,
timeout,
);
modified = true;
}

(modified, output)
(output != input, output)
}

#[inline]
Expand Down

0 comments on commit 77bc36b

Please sign in to comment.