Trying to clean up that ugly function...

This commit is contained in:
Sergio Benitez 2016-04-02 00:58:06 -07:00
parent 5fb12485e8
commit 69a19ccc7f
1 changed files with 3 additions and 2 deletions

View File

@ -51,14 +51,15 @@ impl Router {
pub fn has_collisions(&self) -> bool { pub fn has_collisions(&self) -> bool {
let mut result = false; let mut result = false;
for (_, routes) in &self.routes { for routes in self.routes.values() {
for i in 0..routes.len() { for i in 0..routes.len() {
for j in (i + 1)..routes.len() { for j in (i + 1)..routes.len() {
let (a_route, b_route) = (&routes[i], &routes[j]); let (a_route, b_route) = (&routes[i], &routes[j]);
if a_route.collides_with(b_route) { if a_route.collides_with(b_route) {
result = true; result = true;
println!("{} {} and {} collide!", println!("{} {} and {} collide!",
Yellow.bold().paint("Warning:"), a_route, b_route); Yellow.bold().paint("Warning:"),
a_route, b_route);
} }
} }
} }