Skip to content

Commit

Permalink
fmt all code
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter John committed Sep 18, 2022
1 parent 13ca0b5 commit a2f5155
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/basic.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use tide::http::mime;
use tide::utils::After;
use tide::{Request, Response, log};
use tide_jsx::{view, rsx, component};
use tide::{log, Request, Response};
use tide_jsx::html::HTML5Doctype;
use tide_jsx::{component, rsx, view};

#[component]
fn Heading<'title>(title: &'title str) {
rsx! { <h1 class={"title"}>{title}</h1> }
rsx! { <h1 class={"title"}>{title}</h1> }
}

async fn index(_req: Request<()>) -> tide::Result {
Expand Down
1 change: 0 additions & 1 deletion src/fragment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use crate::Render;
use std::fmt::{Result, Write};

Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ mod text_element;

pub use self::render::Render;
pub use fragment::Fragment;
use tide::{http::mime, StatusCode};
pub use tide_jsx_impl::{component, html, rsx, view};
pub use simple_element::SimpleElement;
pub use text_element::Raw;
use tide::{http::mime, StatusCode};
pub use tide_jsx_impl::{component, html, rsx, view};

impl<'a, T: Render> From<SimpleElement<'a, T>> for tide::Response {
fn from(s: SimpleElement<'a, T>) -> Self {
Expand Down Expand Up @@ -42,6 +42,3 @@ impl<T: Render> From<Fragment<T>> for tide::Result {
Ok(s.into())
}
}



12 changes: 7 additions & 5 deletions tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use pretty_assertions::assert_eq;
use std::borrow::Cow;
use tide::StatusCode;
use tide_jsx::{html, rsx, view, component, Render, raw};
use tide_jsx::html::HTML5Doctype;
use std::borrow::Cow;
use tide_jsx::{component, html, raw, rsx, view, Render};

#[test]
fn ui() {
Expand All @@ -20,7 +20,6 @@ fn works_with_dashes() {

#[test]
fn works_with_raw() {

let actual = html! {
<div>{raw!("<Hello />")}</div>
};
Expand Down Expand Up @@ -156,14 +155,17 @@ async fn render_view() -> std::io::Result<()> {
let result = view! { <p>{"hello"}</p> } as tide::Result;
let mut res = result.unwrap();
assert_eq!(res.status(), StatusCode::Ok);
assert_eq!(res.header("content-type").unwrap().as_str(), tide::http::mime::HTML.to_string());
assert_eq!(
res.header("content-type").unwrap().as_str(),
tide::http::mime::HTML.to_string()
);
assert_eq!(res.take_body().into_string().await.unwrap(), "<p>hello</p>");
Ok(())
}

mod kaki {
use crate::{html, rsx, component, HTML5Doctype, Render};
use crate::other::ExternalPage;
use crate::{component, html, rsx, HTML5Doctype, Render};

// This can be any layout we want
#[component]
Expand Down

0 comments on commit a2f5155

Please sign in to comment.