-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Labels
Description
Describe the bug
The repro below panics with "tv" being None when unwrapped. If the two find_name() calls are swapped there is no problem.
I don't think this is mentioned as a something to be avoided anywhere. I am still fairly new to Rust so my apologies if there is something idiomatic I'm missing here.
To Reproduce
use cursive::{
view::Nameable,
views::{Dialog, TextView},
};
fn main() {
let mut siv = cursive::default();
siv.add_layer(Dialog::around(TextView::new("tv").with_name("tv")).with_name("d"));
let _a = siv.find_name::<Dialog>("d").unwrap();
let _b = siv.find_name::<TextView>("tv").unwrap();
}
Expected behavior
Order of calls to find_name() makes no difference. If the problem was just I should drop the result of find_name() before making another call, that would be fine with me provided it were documented/enforced.
Environment
- Operating system used: macOS 13.5.1
- Backend used: ncurses
- Current locale: en_US.UTF-8
- Cursive version: 75bc082
Reactions are currently unavailable