chore: did a clippy pass

This commit is contained in:
Bram Dingelstad 2024-04-21 14:05:54 +02:00
parent 7b64d525d9
commit 2b0522571c

View file

@ -135,13 +135,7 @@ impl ClientBuilder {
let request_handler = let request_handler =
self.custom_request self.custom_request
.unwrap_or(Arc::new(|request_builder: surf::RequestBuilder| { .unwrap_or(Arc::new(|request_builder: surf::RequestBuilder| {
Box::pin(async move { Box::pin(request_builder)
// let request = request_builder
// .clone()
// .expect("non-stream body request clone to succeed");
request_builder.await
})
})); }));
let http_client = Arc::from(get_http_client(&notion_api_key)); let http_client = Arc::from(get_http_client(&notion_api_key));
@ -181,6 +175,7 @@ pub struct Client {
} }
impl<'a> Client { impl<'a> Client {
#[allow(clippy::new_ret_no_self)]
pub fn new() -> ClientBuilder { pub fn new() -> ClientBuilder {
ClientBuilder::default() ClientBuilder::default()
} }
@ -217,7 +212,7 @@ pub struct Pages {
} }
impl Pages { impl Pages {
pub async fn retrieve<'a>(self, options: PageOptions<'a>) -> Result<Page> { pub async fn retrieve(self, options: PageOptions<'_>) -> Result<Page> {
let url = format!( let url = format!(
"https://api.notion.com/v1/pages/{page_id}", "https://api.notion.com/v1/pages/{page_id}",
page_id = options.page_id page_id = options.page_id
@ -258,10 +253,7 @@ pub struct BlockChildrenListOptions<'a> {
} }
impl BlockChildren { impl BlockChildren {
pub async fn list<'a>( pub async fn list(self, options: BlockChildrenListOptions<'_>) -> Result<QueryResponse<Block>> {
self,
options: BlockChildrenListOptions<'a>,
) -> Result<QueryResponse<Block>> {
let url = format!( let url = format!(
"https://api.notion.com/v1/blocks/{block_id}/children", "https://api.notion.com/v1/blocks/{block_id}/children",
block_id = options.block_id block_id = options.block_id
@ -296,11 +288,7 @@ impl Databases {
let mut request = self.http_client.post(url); let mut request = self.http_client.post(url);
let json = if let Some(filter) = options.filter { let json = options.filter.map(|filter| json!({ "filter": filter }));
Some(json!({ "filter": filter }))
} else {
None
};
let json = if let Some(sorts) = options.sorts { let json = if let Some(sorts) = options.sorts {
if let Some(mut json) = json { if let Some(mut json) = json {
@ -1156,7 +1144,7 @@ where
// Notion forgets to set the formula type, so we're doing it's homework // Notion forgets to set the formula type, so we're doing it's homework
"formula" => { "formula" => {
if let Value::Object(object) = value { if let Value::Object(object) = value {
if let None = object.get("type") { if object.get("type").is_none() {
object.insert("type".to_owned(), json!("string")); object.insert("type".to_owned(), json!("string"));
} }
} }