Fix examples and tests

This commit is contained in:
Alexandre Bury 2016-07-30 13:30:56 -07:00
parent 40f9a91a7a
commit d12622b56a
5 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ fn main() {
// The text is too long to fit on a line, so the view will wrap lines,
// and will adapt to the terminal size.
siv.add_layer(Dialog::new(TextView::new(&content))
siv.add_layer(Dialog::new(TextView::new(content))
.h_align(HAlign::Center)
.button("Quit", |s| s.quit()));
// Show a popup on top of the view.

View File

@ -13,7 +13,7 @@ fn show_popup(siv: &mut Cursive) {
// Look for a view tagged "text". We _know_ it's there, so unwrap it.
let view = s.find_id::<TextView>("text").unwrap();
let content: String = view.get_content().chars().rev().collect();
view.set_content(&content);
view.set_content(content);
})
.dismiss_button("Ok"));

View File

@ -26,6 +26,6 @@ fn main() {
// Let's put the callback in a separate function to keep it clean, but it's not required.
fn show_next_window(siv: &mut Cursive, city: &String) {
siv.pop_layer();
siv.add_layer(Dialog::new(TextView::new(&format!("{} is a great city!", city)))
siv.add_layer(Dialog::new(TextView::new(format!("{} is a great city!", city)))
.button("Quit", |s| s.quit()));
}

View File

@ -43,7 +43,7 @@ use utils::suffix_length;
/// } else {
/// let content = format!("Hello {}!", name);
/// s.pop_layer();
/// s.add_layer(Dialog::new(TextView::new(&content))
/// s.add_layer(Dialog::new(TextView::new(content))
/// .button("Quit", |s| s.quit()));
/// }
/// }));

View File

@ -35,7 +35,7 @@ use unicode_width::UnicodeWidthStr;
/// time_select.set_on_submit(|s, time| {
/// s.pop_layer();
/// let text = format!("You will wait for {} minutes...", time);
/// s.add_layer(Dialog::new(TextView::new(&text))
/// s.add_layer(Dialog::new(TextView::new(text))
/// .button("Quit", |s| s.quit()));
/// });
///