Skip to content

panic from integer parsing #289

@dimpolo

Description

@dimpolo

When parsing something like:
number = 1000 into a u8 I'm getting:

error: proc-macro derive panicked                                                                                                                                                  
    = help: message: called `Result::unwrap()` on an `Err` value: Error("number too large to fit in target type")

This presumably comes from this unwrap:

Lit::Int(ref s) => Ok(s.base10_parse::<$ty>().unwrap()),

Quoting from the docs:

... darling prefers not to fail on the first error it encounters, instead doing as much work as it can, accumulating errors into a single report.

It would be great to replace the unwrap with the usual error handling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions