mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-24 01:24:28 +01:00
style: address clippy clippy::double_ended_iterator_last, and clippy::manual_ok_err (#2025)
This commit is contained in:
@@ -173,10 +173,8 @@ pub async fn get_config(
|
|||||||
let config = Config::global();
|
let config = Config::global();
|
||||||
let value = if let Ok(config_value) = config.get_param::<String>(&query.key) {
|
let value = if let Ok(config_value) = config.get_param::<String>(&query.key) {
|
||||||
Some(config_value)
|
Some(config_value)
|
||||||
} else if let Ok(env_value) = std::env::var(&query.key) {
|
|
||||||
Some(env_value)
|
|
||||||
} else {
|
} else {
|
||||||
None
|
std::env::var(&query.key).ok()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return the value
|
// Return the value
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ impl ToolPermissionStore {
|
|||||||
records
|
records
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|record| record.expiry.is_none_or(|exp| exp > Utc::now().timestamp()))
|
.filter(|record| record.expiry.is_none_or(|exp| exp > Utc::now().timestamp()))
|
||||||
.last()
|
.next_back()
|
||||||
.map(|record| record.allowed)
|
.map(|record| record.allowed)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ impl Resource {
|
|||||||
Some(n) => n,
|
Some(n) => n,
|
||||||
None => url
|
None => url
|
||||||
.path_segments()
|
.path_segments()
|
||||||
.and_then(|segments| segments.last())
|
.and_then(|mut segments| segments.next_back())
|
||||||
.unwrap_or("unnamed")
|
.unwrap_or("unnamed")
|
||||||
.to_string(),
|
.to_string(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user