Skip to content

Called Option::unwrap() on a None value, warning in simple hello world Rocket app #10570

@joemooney

Description

@joemooney

This compiles and runs fine but there is a rust-analyzer warning present in 2.776 and 2.768 but not in 2.760 and earlier versions of rust-analyzer.

 ::::::::::::::
Cargo.toml
::::::::::::::
[package]
name = "foobar"
version = "0.0.1"
edition = "2018"

[dependencies]
rocket = "0.4"
::::::::::::::
src/main.rs
::::::::::::::
#![feature(decl_macro, proc_macro_hygiene)]
#[macro_use]
extern crate rocket;

#[get("/hello")]
fn status() -> String {
    format!("rust-analyzer No warnings in this function")
}

// Compiles fine but rust-analyzer highlights function with:
// called `Option::unwrap()` on a `None` value

#[get("/foobar/<_a>")]
fn foobar(_a: bool) -> String {
    format!("rust-analyzer Warnings in this function")
}

fn main() {
    rocket::ignite()
        .mount("/", routes![status, foobar])
        .launch();
}

Metadata

Metadata

Labels

A-macromacro expansionBroken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions