From fe43d86008a46e4f22bfa0d9e47dcb5d6291d24c Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 20 Mar 2023 23:30:59 -0700 Subject: [PATCH 1/2] Add non_exhaustive to more spots Created using spr 1.3.4 --- dropshot/src/handler.rs | 1 + dropshot/src/router.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/dropshot/src/handler.rs b/dropshot/src/handler.rs index 62b363bf..b2bbf842 100644 --- a/dropshot/src/handler.rs +++ b/dropshot/src/handler.rs @@ -72,6 +72,7 @@ pub type HttpHandlerResult = Result, HttpError>; /// Handle for various interfaces useful during request processing. #[derive(Debug)] +#[non_exhaustive] pub struct RequestContext { /// shared server state pub server: Arc>, diff --git a/dropshot/src/router.rs b/dropshot/src/router.rs index 81bdd8f2..9003affc 100644 --- a/dropshot/src/router.rs +++ b/dropshot/src/router.rs @@ -207,6 +207,7 @@ impl MapValue for VariableValue { /// corresponding values in the actual path, and the expected body /// content type. #[derive(Debug)] +#[non_exhaustive] pub struct RouterLookupResult<'a, Context: ServerContext> { pub handler: &'a dyn RouteHandler, pub variables: VariableSet, From 6deadefc8361189aead3a96cc48ff65cb112a070 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 21 Mar 2023 12:56:22 -0700 Subject: [PATCH 2/2] simplify Created using spr 1.3.4 --- dropshot_endpoint/src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dropshot_endpoint/src/lib.rs b/dropshot_endpoint/src/lib.rs index 6a860dd0..f29131b4 100644 --- a/dropshot_endpoint/src/lib.rs +++ b/dropshot_endpoint/src/lib.rs @@ -392,13 +392,11 @@ fn do_endpoint_inner( }; let request_body_max_bytes = - if let Some(max_bytes) = metadata.request_body_max_bytes { + metadata.request_body_max_bytes.map(|max_bytes| { quote! { .request_body_max_bytes(#max_bytes) } - } else { - quote! {} - }; + }); let dropshot = get_crate(metadata._dropshot_crate);