chore: did a clippy pass
This commit is contained in:
parent
7b64d525d9
commit
2b0522571c
24
src/lib.rs
24
src/lib.rs
|
@ -135,13 +135,7 @@ impl ClientBuilder {
|
|||
let request_handler =
|
||||
self.custom_request
|
||||
.unwrap_or(Arc::new(|request_builder: surf::RequestBuilder| {
|
||||
Box::pin(async move {
|
||||
// let request = request_builder
|
||||
// .clone()
|
||||
// .expect("non-stream body request clone to succeed");
|
||||
|
||||
request_builder.await
|
||||
})
|
||||
Box::pin(request_builder)
|
||||
}));
|
||||
|
||||
let http_client = Arc::from(get_http_client(¬ion_api_key));
|
||||
|
@ -181,6 +175,7 @@ pub struct Client {
|
|||
}
|
||||
|
||||
impl<'a> Client {
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> ClientBuilder {
|
||||
ClientBuilder::default()
|
||||
}
|
||||
|
@ -217,7 +212,7 @@ pub struct 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!(
|
||||
"https://api.notion.com/v1/pages/{page_id}",
|
||||
page_id = options.page_id
|
||||
|
@ -258,10 +253,7 @@ pub struct BlockChildrenListOptions<'a> {
|
|||
}
|
||||
|
||||
impl BlockChildren {
|
||||
pub async fn list<'a>(
|
||||
self,
|
||||
options: BlockChildrenListOptions<'a>,
|
||||
) -> Result<QueryResponse<Block>> {
|
||||
pub async fn list(self, options: BlockChildrenListOptions<'_>) -> Result<QueryResponse<Block>> {
|
||||
let url = format!(
|
||||
"https://api.notion.com/v1/blocks/{block_id}/children",
|
||||
block_id = options.block_id
|
||||
|
@ -296,11 +288,7 @@ impl Databases {
|
|||
|
||||
let mut request = self.http_client.post(url);
|
||||
|
||||
let json = if let Some(filter) = options.filter {
|
||||
Some(json!({ "filter": filter }))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let json = options.filter.map(|filter| json!({ "filter": filter }));
|
||||
|
||||
let json = if let Some(sorts) = options.sorts {
|
||||
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
|
||||
"formula" => {
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue