Skip to content

Commit 3828d61

Browse files
fenollpAdphi
authored andcommitted
continuation of list index fix, for maps this time
Signed-off-by: Pierre Fenoll <[email protected]>
1 parent 4ad7978 commit 3828d61

File tree

1 file changed

+6
-6
lines changed
  • prost-validate-derive-core/src

1 file changed

+6
-6
lines changed

prost-validate-derive-core/src/map.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ impl ToValidationTokens for MapRules {
4444
let field = &ctx.name;
4545
quote! {
4646
for #key in #name.keys() {
47-
{
47+
|| -> ::prost_validate::Result<_> {
4848
#validate
4949
Ok(())
50-
}.map_err(|e| ::prost_validate::Error::new(format!("{}[{}]", #field, #key), ::prost_validate::errors::map::Error::Keys(Box::new(e))))?;
50+
}().map_err(|e| ::prost_validate::Error::new(format!("{}[{}]", #field, #key), ::prost_validate::errors::map::Error::Keys(Box::new(e))))?;
5151
}
5252
}
5353
})
@@ -64,10 +64,10 @@ impl ToValidationTokens for MapRules {
6464
let field = &ctx.name;
6565
quote! {
6666
for (k, #value) in #name.iter() {
67-
{
67+
|| -> ::prost_validate::Result<_> {
6868
#validation
6969
Ok(())
70-
}.map_err(|e| ::prost_validate::Error::new(format!("{}[{}]", #field, k), ::prost_validate::errors::map::Error::Values(Box::new(e))))?;
70+
}().map_err(|e| ::prost_validate::Error::new(format!("{}[{}]", #field, k), ::prost_validate::errors::map::Error::Values(Box::new(e))))?;
7171
}
7272
}
7373
});
@@ -77,10 +77,10 @@ impl ToValidationTokens for MapRules {
7777
let field = &ctx.name;
7878
quote! {
7979
for (k, #value) in #name.iter() {
80-
{
80+
|| -> ::prost_validate::Result<_> {
8181
#validate
8282
Ok(())
83-
}.map_err(|e| ::prost_validate::Error::new(format!("{}[{}]", #field, k), ::prost_validate::errors::map::Error::Values(Box::new(e))))?;
83+
}().map_err(|e| ::prost_validate::Error::new(format!("{}[{}]", #field, k), ::prost_validate::errors::map::Error::Values(Box::new(e))))?;
8484
}
8585
}
8686
})

0 commit comments

Comments
 (0)