Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary colon inside a validation error of a newtype pattern #87

Closed
dpytaylo opened this issue Jan 16, 2024 · 0 comments · Fixed by #91
Closed

Remove unnecessary colon inside a validation error of a newtype pattern #87

dpytaylo opened this issue Jan 16, 2024 · 0 comments · Fixed by #91

Comments

@dpytaylo
Copy link
Contributor

Could we remove a colon from a tuple struct (newtype pattern) with #[garde(transperent)?

For an example:

use garde::Validate;

#[derive(garde::Validate)]
#[garde(transparent)]
struct Username(
    #[garde(length(max = 50))]
    String,
);

fn main() {
    let a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
    println!("{}", Username(a.into()).validate(&()).unwrap_err().to_string());
}

This code will print this:

: length is greater than 50

I suppose that without a colon, this error message might look better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant