Skip to content

Commit 3bb5b8a

Browse files
committed
Make clippy happy
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
1 parent 490c804 commit 3bb5b8a

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

crates/http/src/routes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ pub struct RouteMatch<'router, 'path> {
226226
inner: RouteMatchKind<'router, 'path>,
227227
}
228228

229-
impl<'router, 'path> RouteMatch<'router, 'path> {
229+
impl RouteMatch<'_, '_> {
230230
/// A synthetic match as if the given path was matched against the wildcard route.
231231
/// Used in service chaining.
232232
pub fn synthetic(component_id: String, path: String) -> Self {
@@ -309,7 +309,7 @@ enum RouteMatchKind<'router, 'path> {
309309
},
310310
}
311311

312-
impl<'router, 'path> RouteMatchKind<'router, 'path> {
312+
impl RouteMatchKind<'_, '_> {
313313
/// The route handler that matched the path.
314314
fn route_handler(&self) -> &RouteHandler {
315315
match self {

crates/oci/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,8 @@ pub async fn unpack_archive_layer(
801801
fn digest_from_url(manifest_url: &str) -> Option<String> {
802802
// The URL is in the form "https://host/v2/refname/manifests/sha256:..."
803803
let manifest_url = Url::parse(manifest_url).ok()?;
804-
let segments = manifest_url.path_segments()?;
805-
let last = segments.last()?;
804+
let mut segments = manifest_url.path_segments()?;
805+
let last = segments.next_back()?;
806806
if last.contains(':') {
807807
Some(last.to_owned())
808808
} else {

crates/trigger-http/src/headers.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ pub const RAW_COMPONENT_ROUTE: [&str; 2] = ["SPIN_RAW_COMPONENT_ROUTE", "X_RAW_C
2525
pub const BASE_PATH: [&str; 2] = ["SPIN_BASE_PATH", "X_BASE_PATH"];
2626
pub const CLIENT_ADDR: [&str; 2] = ["SPIN_CLIENT_ADDR", "X_CLIENT_ADDR"];
2727

28+
// Header key/value pairs that use copy on write to avoid allocation
29+
pub type HeaderPair<'a> = ([Cow<'static, str>; 2], Cow<'a, str>);
30+
31+
/// Compute the default headers to be passed to the component.
2832
pub fn compute_default_headers<'a>(
2933
uri: &Uri,
3034
host: &str,
3135
route_match: &'a RouteMatch,
3236
client_addr: SocketAddr,
33-
) -> anyhow::Result<Vec<([Cow<'static, str>; 2], Cow<'a, str>)>> {
37+
) -> anyhow::Result<Vec<HeaderPair<'a>>> {
3438
fn owned(strs: &[&'static str; 2]) -> [Cow<'static, str>; 2] {
3539
[strs[0].into(), strs[1].into()]
3640
}

tests/test-components/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn main() {
5858
.join("debug")
5959
.join(format!("{binary_name}.wasm"));
6060

61-
let adapter_version = package.split('v').last().and_then(|v| match v {
61+
let adapter_version = package.split('v').next_back().and_then(|v| match v {
6262
// Only allow these versions through
6363
"0.2.0-rc-2023-11-10" | "0.2.0" => Some(v),
6464
_ => None,

0 commit comments

Comments
 (0)