Skip to content

Commit

Permalink
fix clippy beta lints (exercism#1262)
Browse files Browse the repository at this point in the history
* fix clippy beta lints

* fix accidental changes to test semantics
  • Loading branch information
coriolinus authored May 12, 2021
1 parent a4dd01b commit 676b883
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion exercises/concept/magazine-cutout/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Given the following input
```rust
let magazine = "two times three is not four".split_whitespace().collect::<Vec<&str>>();
let note = "two times two is four".split_whitespace().collect::<Vec<&str>>();
assert_eq!(can_construct_note(&magazine, &note), false);
assert!(!can_construct_note(&magazine, &note));
```

The function returns `false` since the magazine only contains one instance of `"two"` when the note requires two of them.
10 changes: 5 additions & 5 deletions exercises/concept/magazine-cutout/tests/magazine-cutout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn test_example_works() {
let note = "two times two is four"
.split_whitespace()
.collect::<Vec<&str>>();
assert_eq!(can_construct_note(&magazine, &note), false);
assert!(!can_construct_note(&magazine, &note));
}

#[test]
Expand All @@ -18,7 +18,7 @@ fn test_fn_returns_true_for_good_input() {
let note = "give one grand today."
.split_whitespace()
.collect::<Vec<&str>>();
assert_eq!(can_construct_note(&magazine, &note), true);
assert!(can_construct_note(&magazine, &note));
}

#[test]
Expand All @@ -30,7 +30,7 @@ fn test_fn_returns_false_for_bad_input() {
let note = "I've got som coconuts"
.split_whitespace()
.collect::<Vec<&str>>();
assert_eq!(can_construct_note(&magazine, &note), false);
assert!(!can_construct_note(&magazine, &note));
}

#[test]
Expand All @@ -42,13 +42,13 @@ fn test_case_sensitivity() {
let note = "I've got some coconuts"
.split_whitespace()
.collect::<Vec<&str>>();
assert_eq!(can_construct_note(&magazine, &note), false);
assert!(!can_construct_note(&magazine, &note));

let magazine = "I've got some lovely coconuts"
.split_whitespace()
.collect::<Vec<&str>>();
let note = "i've got some coconuts"
.split_whitespace()
.collect::<Vec<&str>>();
assert_eq!(can_construct_note(&magazine, &note), false);
assert!(!can_construct_note(&magazine, &note));
}
31 changes: 12 additions & 19 deletions exercises/practice/isogram/tests/isogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,74 @@ use isogram::check;

#[test]
fn empty_string() {
assert_eq!(check(""), true, "An empty string should be an isogram.")
assert!(check(""), "An empty string should be an isogram.")
}

#[test]
#[ignore]
fn only_lower_case_characters() {
assert_eq!(check("isogram"), true, "\"isogram\" should be an isogram.")
assert!(check("isogram"), "\"isogram\" should be an isogram.")
}

#[test]
#[ignore]
fn one_duplicated_character() {
assert_eq!(
check("eleven"),
false,
assert!(
!check("eleven"),
"\"eleven\" has more than one \'e\', therefore it is no isogram."
)
}

#[test]
#[ignore]
fn longest_reported_english_isogram() {
assert_eq!(
assert!(
check("subdermatoglyphic"),
true,
"\"subdermatoglyphic\" should be an isogram."
)
}

#[test]
#[ignore]
fn one_duplicated_character_mixed_case() {
assert_eq!(
check("Alphabet"),
false,
assert!(
!check("Alphabet"),
"\"Alphabet\" has more than one \'a\', therefore it is no isogram."
)
}

#[test]
#[ignore]
fn hypothetical_isogramic_word_with_hyphen() {
assert_eq!(
assert!(
check("thumbscrew-japingly"),
true,
"\"thumbscrew-japingly\" should be an isogram."
)
}

#[test]
#[ignore]
fn isogram_with_duplicated_hyphen() {
assert_eq!(
assert!(
check("six-year-old"),
true,
"\"six-year-old\" should be an isogram."
)
}

#[test]
#[ignore]
fn made_up_name_that_is_an_isogram() {
assert_eq!(
assert!(
check("Emily Jung Schwartzkopf"),
true,
"\"Emily Jung Schwartzkopf\" should be an isogram."
)
}

#[test]
#[ignore]
fn duplicated_character_in_the_middle() {
assert_eq!(
check("accentor"),
false,
assert!(
!check("accentor"),
"\"accentor\" has more than one \'c\', therefore it is no isogram."
)
}

0 comments on commit 676b883

Please sign in to comment.