From ecd9bac5ff9136601117f25a2dd73dbdd4e8594d Mon Sep 17 00:00:00 2001 From: Luis Alberto Santos Date: Sun, 19 Jan 2025 18:01:52 +0100 Subject: [PATCH] ctx is always a ref --- README.md | 2 +- garde/tests/rules/dive_with_ctx.rs | 2 +- garde_derive/src/emit.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 297555c..7667853 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ if let Err(e) = data.validate() { Additional notes: - `required` is only available for `Option` fields. -- `dive` accepts an optional context: `#[garde(dive(&self.other_field))]` +- `dive` accepts an optional context: `#[garde(dive(self.other_field))]` - The `` argument for `length` is [explained here](#length-modes) - For `length` and `range`: - If `equal` is defined, `min` and `max` must be omitted. diff --git a/garde/tests/rules/dive_with_ctx.rs b/garde/tests/rules/dive_with_ctx.rs index 69c946c..84c52d7 100644 --- a/garde/tests/rules/dive_with_ctx.rs +++ b/garde/tests/rules/dive_with_ctx.rs @@ -13,7 +13,7 @@ struct Test<'a> { min: usize, #[garde(skip)] max: usize, - #[garde(dive(&(self.min, self.max)))] + #[garde(dive((self.min, self.max)))] inner: Inner<'a>, } diff --git a/garde_derive/src/emit.rs b/garde_derive/src/emit.rs index 2c59985..9e2d1d2 100644 --- a/garde_derive/src/emit.rs +++ b/garde_derive/src/emit.rs @@ -392,7 +392,7 @@ where (Some((_, Some(ctx))), None) => Some(quote! { ::garde::validate::Validate::validate_into( &*__garde_binding, - #ctx, + &#ctx, &mut __garde_path, __garde_report, );