Called `Option::unwrap()` on a `None` value

I get this macro expansion warning with matklad.rust-analyzer v 0.2.776 with VSCode but not with cargo builld.

If I take out the a and b parameters the macro warning goes away.
Also, if I strip out much of the rest of the code then the warning goes away. Its unclear at what point when I add back in all the rest of my code it trips rust-analyzer into generating this warning for every route get/put/post with an argument.

Any tips on how I can begin to try to debug the issue?

This is the top of my

#![feature(decl_macro, proc_macro_hygiene)]

extern crate rocket;
extern crate rocket_contrib;

use rocket::response::Stream;
use rocket_contrib::json::JsonValue;
fn foobar(a: usize, b: usize) {  // <-- this function is highlighted in red
    println!("foobar {} {}", a, b);

when I cargo expand I get

fn foobar(a: usize, b: usize) {
            &["foobar ", " ", "\n"],
            &match (&a, &b) {
                (arg0, arg1) => [
                    ::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Display::fmt),
                    ::core::fmt::ArgumentV1::new(arg1, ::core::fmt::Display::fmt),

I stripped out everything I could and still get the warning

name = "foobar"
version = "0.0.1"
edition = "2018"

rocket = "0.4"
#![feature(decl_macro, proc_macro_hygiene)]
extern crate rocket;

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

fn foobar(_a: bool) -> String {
    format!("rust-analyzer Warnings in this function")

fn main() {
        .mount("/", routes![status, foobar])

Ok, I was able to change the rust-analyzer extension version back to 2.760 and the warning went away. 2.776 and 2.768 both have this warning. I will open a ticket.

Opened Issue:


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.