Skip to content

Commit 10bec8a

Browse files
committed
Satisfy rustfmt
1 parent e3761ae commit 10bec8a

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

examples/test.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ use postgrest::Postgrest;
33
#[tokio::main]
44
async fn main() -> Result<(), Box<dyn std::error::Error>> {
55
let client = Postgrest::new("https://hacks.soedirgo.dev/postgrest");
6-
let resp = client
7-
.from("todos")
8-
.select("*")
9-
.execute()
10-
.await?;
6+
let resp = client.from("todos").select("*").execute().await?;
117
println!("{}", resp.text().await?);
128
Ok(())
139
}

src/builder.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,29 @@ impl Builder {
3232
// TODO: URL-encoded payload
3333
pub fn insert(mut self, body: &str) -> Self {
3434
self.method = Some(Method::POST);
35-
self.headers.push(("Prefer".to_string(), "return=representation".to_string()));
35+
self.headers
36+
.push(("Prefer".to_string(), "return=representation".to_string()));
3637
self.body = Some(body.to_string());
3738
self
3839
}
3940

4041
pub fn update(mut self, body: &str) -> Self {
4142
self.method = Some(Method::PATCH);
42-
self.headers.push(("Prefer".to_string(), "return=representation".to_string()));
43+
self.headers
44+
.push(("Prefer".to_string(), "return=representation".to_string()));
4345
self.body = Some(body.to_string());
4446
self
4547
}
4648

4749
pub fn delete(mut self) -> Self {
4850
self.method = Some(Method::DELETE);
49-
self.headers.push(("Prefer".to_string(), "return=representation".to_string()));
51+
self.headers
52+
.push(("Prefer".to_string(), "return=representation".to_string()));
5053
self
5154
}
5255

5356
pub async fn execute(self) -> Result<Response, Error> {
54-
let mut req = Client::new().request(
55-
self.method.unwrap(),
56-
&self.url,
57-
);
57+
let mut req = Client::new().request(self.method.unwrap(), &self.url);
5858
for (k, v) in &self.headers {
5959
req = req.header(k, v);
6060
}
@@ -63,8 +63,7 @@ impl Builder {
6363
req = req.body(body);
6464
}
6565

66-
let resp = req.send()
67-
.await?;
66+
let resp = req.send().await?;
6867

6968
Ok(resp)
7069
}

0 commit comments

Comments
 (0)