diff --git a/lib/src/config/dictionaries.rs b/lib/src/config/dictionaries.rs index f9f2fd82..30178051 100644 --- a/lib/src/config/dictionaries.rs +++ b/lib/src/config/dictionaries.rs @@ -56,7 +56,7 @@ impl Dictionary { /// Reads the contents of a JSON dictionary file. fn read_json_contents(file: &Path) -> Result, DictionaryConfigError> { // Read the contents of the given file. - let data = fs::read_to_string(&file).map_err(DictionaryConfigError::IoError)?; + let data = fs::read_to_string(file).map_err(DictionaryConfigError::IoError)?; // Deserialize the contents of the given JSON file. let json = match serde_json::from_str(&data) diff --git a/lib/src/config/object_store.rs b/lib/src/config/object_store.rs index f17fe8b4..6602d54d 100644 --- a/lib/src/config/object_store.rs +++ b/lib/src/config/object_store.rs @@ -70,7 +70,7 @@ impl TryFrom for ObjectStoreConfig { err: ObjectStoreConfigError::PathNotAString(key.to_string()), } })?; - fs::read(&path).map_err(|e| { + fs::read(path).map_err(|e| { FastlyConfigError::InvalidObjectStoreDefinition { name: store.to_string(), err: ObjectStoreConfigError::IoError(e), diff --git a/lib/src/session.rs b/lib/src/session.rs index 05edd48e..990aaf47 100644 --- a/lib/src/session.rs +++ b/lib/src/session.rs @@ -710,8 +710,7 @@ impl Session { /// stored within each [`SelectTarget`]. pub fn reinsert_select_targets(&mut self, targets: Vec) { for target in targets { - let async_handle: AsyncItemHandle = target.handle.into(); - self.async_items[async_handle] = Some(target.item); + self.async_items[target.handle] = Some(target.item); } } @@ -732,7 +731,7 @@ impl Session { self.async_items .get_mut(handle) .map(|ai| ai.as_mut()) - .ok_or(HandleError::InvalidAsyncItemHandle(handle.into())) + .ok_or_else(|| HandleError::InvalidAsyncItemHandle(handle.into())) } pub fn take_async_item(&mut self, handle: AsyncItemHandle) -> Result { @@ -742,7 +741,7 @@ impl Session { self.async_items .get_mut(handle) .and_then(|tracked| tracked.take()) - .ok_or(HandleError::InvalidAsyncItemHandle(handle.into())) + .ok_or_else(|| HandleError::InvalidAsyncItemHandle(handle.into())) } pub async fn select_impl( diff --git a/lib/src/wiggle_abi/req_impl.rs b/lib/src/wiggle_abi/req_impl.rs index 2bb39070..b1754d54 100644 --- a/lib/src/wiggle_abi/req_impl.rs +++ b/lib/src/wiggle_abi/req_impl.rs @@ -202,7 +202,7 @@ impl FastlyHttpReq for Session { .as_array(config.host_override_len) .as_slice()?; - Some(HeaderValue::from_bytes(&*byte_slice)?) + Some(HeaderValue::from_bytes(&byte_slice)?) } else { None };