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

Panic on input that is not valid UTF8 #99

Closed
dtolnay opened this issue Jul 6, 2016 · 2 comments
Closed

Panic on input that is not valid UTF8 #99

dtolnay opened this issue Jul 6, 2016 · 2 comments
Assignees
Labels

Comments

@dtolnay
Copy link
Member

dtolnay commented Jul 6, 2016

This should be an error not a panic.

fn main() {
    let data = &[b'"', b'\xed', b'\xa0', b'\x80', b'"'];
    serde_json::from_slice::<String>(data).ok();
}
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 0 }'

Caused by this unwrap.

@dtolnay dtolnay added the bug label Jul 6, 2016
@dtolnay dtolnay self-assigned this Jul 6, 2016
@oli-obk
Copy link
Member

oli-obk commented Jul 6, 2016

we could generally enable the clippy lint for denying unwrap

@dtolnay
Copy link
Member Author

dtolnay commented Jul 6, 2016

I fixed the panic in #100 and I filed #101 to consider enabling the Clippy lint.

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

No branches or pull requests

2 participants