Skip to content

Commit cd975d8

Browse files
committed
cargo fmt --all on 1.41.0
1 parent 720e9ee commit cd975d8

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

examples/json.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ fn main() -> io::Result<()> {
1111
task::block_on(async {
1212
let mut app = tide::new();
1313

14-
app.at("/submit").post(|mut req: tide::Request<()>| {
15-
async move {
14+
app.at("/submit")
15+
.post(|mut req: tide::Request<()>| async move {
1616
let cat: Cat = req.body_json().await.unwrap();
1717
println!("cat name: {}", cat.name);
1818

1919
let cat = Cat {
2020
name: "chashu".into(),
2121
};
2222
tide::Response::new(200).body_json(&cat).unwrap()
23-
}
24-
});
23+
});
2524

2625
app.listen("127.0.0.1:8080").await?;
2726
Ok(())

tests/nested.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ fn nested_middleware() {
9393
fn nested_with_different_state() {
9494
let mut outer = tide::new();
9595
let mut inner = tide::with_state(42);
96-
inner.at("/").get(|req: tide::Request<i32>| {
97-
async move {
98-
let num = req.state();
99-
format!("the number is {}", num)
100-
}
96+
inner.at("/").get(|req: tide::Request<i32>| async move {
97+
let num = req.state();
98+
format!("the number is {}", num)
10199
});
102100
outer.at("/").get(|_| async move { "Hello, world!" });
103101
outer.at("/foo").nest(inner);

tests/server.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ fn hello_world() -> Result<(), surf::Exception> {
99
task::block_on(async {
1010
let server = task::spawn(async {
1111
let mut app = tide::new();
12-
app.at("/").get(|mut req: tide::Request<()>| {
13-
async move {
14-
assert_eq!(req.body_string().await.unwrap(), "nori".to_string());
15-
tide::Response::new(200).body_string("says hello".to_string())
16-
}
12+
app.at("/").get(|mut req: tide::Request<()>| async move {
13+
assert_eq!(req.body_string().await.unwrap(), "nori".to_string());
14+
tide::Response::new(200).body_string("says hello".to_string())
1715
});
1816
app.listen("localhost:8080").await?;
1917
Result::<(), surf::Exception>::Ok(())
@@ -67,13 +65,11 @@ fn json() -> Result<(), surf::Exception> {
6765
task::block_on(async {
6866
let server = task::spawn(async {
6967
let mut app = tide::new();
70-
app.at("/").get(|mut req: tide::Request<()>| {
71-
async move {
72-
let mut counter: Counter = req.body_json().await.unwrap();
73-
assert_eq!(counter.count, 0);
74-
counter.count = 1;
75-
tide::Response::new(200).body_json(&counter).unwrap()
76-
}
68+
app.at("/").get(|mut req: tide::Request<()>| async move {
69+
let mut counter: Counter = req.body_json().await.unwrap();
70+
assert_eq!(counter.count, 0);
71+
counter.count = 1;
72+
tide::Response::new(200).body_json(&counter).unwrap()
7773
});
7874
app.listen("localhost:8082").await?;
7975
Result::<(), surf::Exception>::Ok(())

0 commit comments

Comments
 (0)