From 30f13fc260e454ba5650d119ad9b8bc88182a70a Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Sun, 26 Feb 2017 16:01:23 -0800 Subject: [PATCH] Edit refcell_view example to use `find_id` --- examples/refcell_view.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/refcell_view.rs b/examples/refcell_view.rs index abe7473..593d928 100644 --- a/examples/refcell_view.rs +++ b/examples/refcell_view.rs @@ -28,12 +28,12 @@ fn on_edit(siv: &mut Cursive, _content: &str, _cursor: usize) { // Get handles for each view. let edit_1 = siv.find_id_mut::("1").unwrap(); let edit_2 = siv.find_id_mut::("2").unwrap(); - let mut text = siv.find_id_mut::("match").unwrap(); // Directly compare references to edit_1 and edit_2. - text.set_content(if edit_1.get_content() == edit_2.get_content() { + let matches = edit_1.get_content() == edit_2.get_content(); + siv.find_id("match", |v: &mut TextView| v.set_content(if matches { "match" } else { "no match" - }); + })); }