Skip to content

Examples full of unsafe usage of .unwrap() #3984

@CharlemagneLasse

Description

@CharlemagneLasse

I've just looked through the examples and documentation how to write a good handlers. And all over the place, the it uses .unwrap on Results which could also be Err. This leads to panics in rust - basically what Cloudflare took down last week.

Here are a couple of unsafe unwraps:

And when I would now remove these unwraps+ the Ok and directly try to return the Result... it would now work because these Response builders are using as Error type hyper::http::Errors and all the examples are build around hyper::Error.

The examples are basically only showing us how to not to write good servers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions