Skip to content

Commit

Permalink
Merge pull request #30 from cakebaker/fix_clippy_warnings
Browse files Browse the repository at this point in the history
clippy: fix warnings from useless_vec lint
  • Loading branch information
sylvestre authored Mar 24, 2024
2 parents 4ed7ea1 + f916f1c commit a304ac0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/context_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@ mod tests {
#[test]
fn test_stop_early() {
let from_filename = "foo";
let from = vec!["a", "b", "c", ""].join("\n");
let from = ["a", "b", "c", ""].join("\n");
let to_filename = "bar";
let to = vec!["a", "d", "c", ""].join("\n");
let to = ["a", "d", "c", ""].join("\n");
let context_size: usize = 3;

let diff_full = diff(
Expand All @@ -716,7 +716,7 @@ mod tests {
context_size,
false,
);
let expected_full = vec![
let expected_full = [
"*** foo\t",
"--- bar\t",
"***************",
Expand All @@ -741,7 +741,7 @@ mod tests {
context_size,
true,
);
let expected_brief = vec!["*** foo\t", "--- bar\t", ""].join("\n");
let expected_brief = ["*** foo\t", "--- bar\t", ""].join("\n");
assert_eq!(diff_brief, expected_brief.as_bytes());

let nodiff_full = diff(
Expand Down
8 changes: 4 additions & 4 deletions src/ed_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ mod tests {
let from = b"a\n";
let to = b"b\n";
let diff = diff(from, to, false).unwrap();
let expected = vec!["1c", "b", ".", ""].join("\n");
let expected = ["1c", "b", ".", ""].join("\n");
assert_eq!(diff, expected.as_bytes());
}

Expand Down Expand Up @@ -401,11 +401,11 @@ mod tests {

#[test]
fn test_stop_early() {
let from = vec!["a", "b", "c", ""].join("\n");
let to = vec!["a", "d", "c", ""].join("\n");
let from = ["a", "b", "c", ""].join("\n");
let to = ["a", "d", "c", ""].join("\n");

let diff_full = diff(from.as_bytes(), to.as_bytes(), false).unwrap();
let expected_full = vec!["2c", "d", ".", ""].join("\n");
let expected_full = ["2c", "d", ".", ""].join("\n");
assert_eq!(diff_full, expected_full.as_bytes());

let diff_brief = diff(from.as_bytes(), to.as_bytes(), true).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/normal_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,11 @@ mod tests {

#[test]
fn test_stop_early() {
let from = vec!["a", "b", "c"].join("\n");
let to = vec!["a", "d", "c"].join("\n");
let from = ["a", "b", "c"].join("\n");
let to = ["a", "d", "c"].join("\n");

let diff_full = diff(from.as_bytes(), to.as_bytes(), false);
let expected_full = vec!["2c2", "< b", "---", "> d", ""].join("\n");
let expected_full = ["2c2", "< b", "---", "> d", ""].join("\n");
assert_eq!(diff_full, expected_full.as_bytes());

let diff_brief = diff(from.as_bytes(), to.as_bytes(), true);
Expand Down
8 changes: 4 additions & 4 deletions src/unified_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,9 @@ mod tests {
#[test]
fn test_stop_early() {
let from_filename = "foo";
let from = vec!["a", "b", "c", ""].join("\n");
let from = ["a", "b", "c", ""].join("\n");
let to_filename = "bar";
let to = vec!["a", "d", "c", ""].join("\n");
let to = ["a", "d", "c", ""].join("\n");
let context_size: usize = 3;

let diff_full = diff(
Expand All @@ -870,7 +870,7 @@ mod tests {
context_size,
false,
);
let expected_full = vec![
let expected_full = [
"--- foo\t",
"+++ bar\t",
"@@ -1,3 +1,3 @@",
Expand All @@ -891,7 +891,7 @@ mod tests {
context_size,
true,
);
let expected_brief = vec!["--- foo\t", "+++ bar\t", ""].join("\n");
let expected_brief = ["--- foo\t", "+++ bar\t", ""].join("\n");
assert_eq!(diff_brief, expected_brief.as_bytes());

let nodiff_full = diff(
Expand Down

0 comments on commit a304ac0

Please sign in to comment.