chore: run cargo fmt

This commit is contained in:
jeangab 2023-08-15 15:24:55 -04:00
parent 5d6ab1fa71
commit 63c13e1739
11 changed files with 176 additions and 207 deletions

View File

@ -1,9 +1,9 @@
use crate::components::BackgroundProps;
use crate::components::Background;
use crate::routes::whymdc::*;
use crate::routes::home::*;
use crate::routes::empty::*;
use crate::components::BackgroundProps;
use crate::routes::blog::*;
use crate::routes::empty::*;
use crate::routes::home::*;
use crate::routes::whymdc::*;
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
@ -44,4 +44,3 @@ pub fn App(cx: Scope) -> impl IntoView {
</Router>
}
}

View File

@ -40,7 +40,11 @@ pub fn Background(cx: Scope, class: &'static str) -> impl IntoView {
context_to_render.move_to(n.position.x.into(), n.position.y.into());
context_to_render.line_to(child.position.x.into(), child.position.y.into());
};
let mut sc = SpaceColonization::new(width.try_into().unwrap(), height.try_into().unwrap(), render_node_fn);
let mut sc = SpaceColonization::new(
width.try_into().unwrap(),
height.try_into().unwrap(),
render_node_fn,
);
let nodes = Rc::new(RefCell::new(Vec::new()));
nodes.borrow_mut().push(Node::new(Point::new((
(window_width / 3) as i32,

View File

@ -1,6 +1,6 @@
mod codeblock;
mod code;
mod background;
pub use codeblock::*;
pub use code::*;
mod code;
mod codeblock;
pub use background::*;
pub use code::*;
pub use codeblock::*;

View File

@ -1,7 +1,7 @@
mod space_colonization;
pub mod app;
mod components;
mod routes;
mod space_colonization;
use cfg_if::cfg_if;
cfg_if! {

View File

@ -1,6 +1,6 @@
use crate::components::*;
use leptos::*;
use leptos_meta::*;
use crate::components::*;
#[component]
pub fn Blog(cx: Scope) -> impl IntoView {

View File

@ -1,4 +1,4 @@
pub mod whymdc;
pub mod home;
pub mod blog;
pub mod empty;
pub mod home;
pub mod whymdc;

View File

@ -31,5 +31,3 @@ pub fn SubsectionTitle(cx: Scope, dark: bool, children: Children) -> impl IntoVi
<h5 class={class}>{children(cx)}</h5>
}
}

View File

@ -69,24 +69,15 @@ mod tests {
#[test]
fn distance_to_itself_is_zero() {
let p = Point {
x: 1,
y: 1,
};
let p = Point { x: 1, y: 1 };
assert_eq!(p.distance(&p), 0.0);
}
#[test]
fn distance_same_x_is_y() {
let p1 = Point {
x: 1,
y: 1,
};
let p1 = Point { x: 1, y: 1 };
let p2 = Point {
x: 1,
y: 5,
};
let p2 = Point { x: 1, y: 5 };
assert_eq!(p1.distance(&p2), 4.0);
}
@ -122,60 +113,36 @@ mod tests {
#[test]
fn distance_quadrant3() {
let p1 = Point {
x: 3,
y: 4,
};
let p1 = Point { x: 3, y: 4 };
let p2 = Point {
x: 0,
y: 0,
};
let p2 = Point { x: 0, y: 0 };
assert_eq!(p1.distance(&p2), 5.0);
}
#[test]
fn distance_quadrant2() {
let p1 = Point {
x: 3,
y: 4,
};
let p1 = Point { x: 3, y: 4 };
let p2 = Point {
x: 0,
y: 100,
};
let p2 = Point { x: 0, y: 100 };
assert_eq!(p1.distance(&p2) as f32, 96.04687);
}
#[test]
fn distance_quadrant2_fast() {
let p1 = Point {
x: 3,
y: 4,
};
let p1 = Point { x: 3, y: 4 };
let p2 = Point {
x: 3,
y: 50,
};
let p2 = Point { x: 3, y: 50 };
assert_eq!(p1.distance(&p2), 46.0);
}
#[test]
fn distance_quadrant4() {
let p1 = Point {
x: 3,
y: 4,
};
let p1 = Point { x: 3, y: 4 };
let p2 = Point {
x: 50,
y: -50,
};
let p2 = Point { x: 50, y: -50 };
assert_eq!(p1.distance(&p2) as f32, 71.5891);
}
@ -234,4 +201,3 @@ mod tests {
assert_eq!(root.movement(node, 5), Point::new((10, 45)));
}
}

View File

@ -154,8 +154,10 @@ mod test {
assert_eq!(
index.get_surrounding_elements(&Point::new((50, 50))).sort(),
vec![
&4040, &4545, &5040, &6040, &4050, &5050, &6050, &5050, &5151, &6060, &4060, &5060, &6060,
].sort()
&4040, &4545, &5040, &6040, &4050, &5050, &6050, &5050, &5151, &6060, &4060, &5060,
&6060,
]
.sort()
);
}