Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
mgattozzi committed Nov 4, 2022
1 parent ef2df0b commit 9731ae9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/src/config/dictionaries.rs
Expand Up @@ -56,7 +56,7 @@ impl Dictionary {
/// Reads the contents of a JSON dictionary file.
fn read_json_contents(file: &Path) -> Result<HashMap<String, String>, 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)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/config/object_store.rs
Expand Up @@ -70,7 +70,7 @@ impl TryFrom<Table> 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),
Expand Down
7 changes: 3 additions & 4 deletions lib/src/session.rs
Expand Up @@ -710,8 +710,7 @@ impl Session {
/// stored within each [`SelectTarget`].
pub fn reinsert_select_targets(&mut self, targets: Vec<SelectTarget>) {
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);
}
}

Expand All @@ -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<AsyncItem, HandleError> {
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/wiggle_abi/req_impl.rs
Expand Up @@ -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
};
Expand Down

0 comments on commit 9731ae9

Please sign in to comment.