Fix clippy warning, use unwrap_or_default()

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2023-11-14 22:47:45 +01:00
parent d7804386a0
commit eae3a56c30
No known key found for this signature in database

View file

@ -392,7 +392,7 @@ impl SpClient {
) -> SpClientResult { ) -> SpClientResult {
let body = protobuf::text_format::print_to_string(message); let body = protobuf::text_format::print_to_string(message);
let mut headers = headers.unwrap_or_else(HeaderMap::new); let mut headers = headers.unwrap_or_default();
headers.insert( headers.insert(
CONTENT_TYPE, CONTENT_TYPE,
HeaderValue::from_static("application/x-protobuf"), HeaderValue::from_static("application/x-protobuf"),
@ -409,7 +409,7 @@ impl SpClient {
headers: Option<HeaderMap>, headers: Option<HeaderMap>,
body: Option<&str>, body: Option<&str>,
) -> SpClientResult { ) -> SpClientResult {
let mut headers = headers.unwrap_or_else(HeaderMap::new); let mut headers = headers.unwrap_or_default();
headers.insert(ACCEPT, HeaderValue::from_static("application/json")); headers.insert(ACCEPT, HeaderValue::from_static("application/json"));
self.request(method, endpoint, Some(headers), body).await self.request(method, endpoint, Some(headers), body).await