Skip to content

Commit

Permalink
Take care of clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
whitfin committed Jun 27, 2022
1 parent ee40ac1 commit e443f58
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<T> Router<T> {
let mut current = &self.root;
let mut captures = Vec::new();

for segment in path.split('/').filter(|s| *s != "") {
for segment in path.split('/').filter(|s| !s.is_empty()) {
current = current
.children()
.iter()
Expand Down Expand Up @@ -105,7 +105,7 @@ impl<T> Router<T> {
{
let mut current = &mut self.root;

for segment in path.split('/').filter(|s| *s != "") {
for segment in path.split('/').filter(|s| !s.is_empty()) {
let child = current
.children()
.iter()
Expand Down
8 changes: 4 additions & 4 deletions tests/capture_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ pub mod capture {
let path = "/api/v1/user/123";
let captures = vec![("vsn", (5, 7)), ("type", (8, 12)), ("id", (13, 16))];

let id = find_capture(&path, &captures, "id");
let id = find_capture(path, &captures, "id");
assert_eq!(id, Some("123"));

let object = find_capture(&path, &captures, "type");
let object = find_capture(path, &captures, "type");
assert_eq!(object, Some("user"));

let version = find_capture(&path, &captures, "vsn");
let version = find_capture(path, &captures, "vsn");
assert_eq!(version, Some("v1"));

let missing = find_capture(&path, &captures, "missing");
let missing = find_capture(path, &captures, "missing");
assert_eq!(missing, None);
}
}
12 changes: 6 additions & 6 deletions tests/matcher_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pub mod matcher {
fn static_matching() {
let matcher = StaticMatcher::new("value");

assert_eq!(matcher.is_match("value"), true);
assert_eq!(matcher.is_match("not-value"), false);
assert!(matcher.is_match("value"));
assert!(!matcher.is_match("not-value"));

assert_eq!(matcher.capture("value"), None);
assert_eq!(matcher.capture("not-value"), None);
Expand All @@ -16,8 +16,8 @@ pub mod matcher {
fn dynamic_matching() {
let matcher = DynamicMatcher::new("field");

assert_eq!(matcher.is_match("value"), true);
assert_eq!(matcher.is_match("not-value"), true);
assert!(matcher.is_match("value"));
assert!(matcher.is_match("not-value"));

assert_eq!(matcher.capture("value"), Some(("field", (0, 5))));
assert_eq!(matcher.capture("not-value"), Some(("field", (0, 9))));
Expand All @@ -27,8 +27,8 @@ pub mod matcher {
fn closure_matching() {
let matcher = |input: &str| input == "value";

assert_eq!(matcher.is_match("value"), true);
assert_eq!(matcher.is_match("not-value"), false);
assert!(matcher.is_match("value"));
assert!(!matcher.is_match("not-value"));

assert_eq!(matcher.capture("value"), None);
assert_eq!(matcher.capture("not-value"), None);
Expand Down

0 comments on commit e443f58

Please sign in to comment.