I am trying to call an unsafe function with the let-else pattern but with unsafe it doesn't seem to work:
fn func() -> Option<i32> {}
let Some(test) = unsafe { func() } else {
my_logger("error");
return;
};
right curly brace `}` before `else` in a `let...else` statement not allowed
This seems to work but test is not accessible after the scope:
fn func() -> Option<i32> {}
unsafe {
let Some(test) = func() else {
my_logger("error");
return;
};
}