From 607e82487df964a4cedb01071cecf5047773eca9 Mon Sep 17 00:00:00 2001 From: Charles Samborski Date: Thu, 7 Dec 2017 12:17:07 +0100 Subject: [PATCH] Remove local variables in `FileChooserDialog::with_buttons` This commit removes the Stash variables from `FileChooserDialog::with_buttons`, as requested in the PR #602 --- src/file_chooser_dialog.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/file_chooser_dialog.rs b/src/file_chooser_dialog.rs index 595a20cdc4..95aff8dc96 100644 --- a/src/file_chooser_dialog.rs +++ b/src/file_chooser_dialog.rs @@ -42,43 +42,37 @@ impl FileChooserDialog { ) }, 1 => { - let first_button_text: Stash<*const c_char, str> = buttons[0].0.to_glib_none(); ffi::gtk_file_chooser_dialog_new( title.to_glib_none().0, parent.to_glib_none().0, action.to_glib(), - first_button_text.0, + buttons[0].0.to_glib_none().0, buttons[0].1.to_glib(), ptr::null::(), ) }, 2 => { - let first_button_text: Stash<*const c_char, str> = buttons[0].0.to_glib_none(); - let second_button_text: Stash<*const c_char, str> = buttons[1].0.to_glib_none(); ffi::gtk_file_chooser_dialog_new( title.to_glib_none().0, parent.to_glib_none().0, action.to_glib(), - first_button_text.0, + buttons[0].0.to_glib_none().0, buttons[0].1.to_glib(), - second_button_text.0, + (buttons[1].0.to_glib_none() as Stash<*const c_char, str>).0, buttons[1].1.to_glib(), ptr::null::(), ) }, 3 => { - let first_button_text: Stash<*const c_char, str> = buttons[0].0.to_glib_none(); - let second_button_text: Stash<*const c_char, str> = buttons[1].0.to_glib_none(); - let third_button_text: Stash<*const c_char, str> = buttons[2].0.to_glib_none(); ffi::gtk_file_chooser_dialog_new( title.to_glib_none().0, parent.to_glib_none().0, action.to_glib(), - first_button_text.0, + buttons[0].0.to_glib_none().0, buttons[0].1.to_glib(), - second_button_text.0, + (buttons[1].0.to_glib_none() as Stash<*const c_char, str>).0, buttons[1].1.to_glib(), - third_button_text.0, + (buttons[2].0.to_glib_none() as Stash<*const c_char, str>).0, buttons[2].1.to_glib(), ptr::null::(), )