refactor: migrate panic!() usage to Rust 2021
This commit refactors code to conform to some changes in Rust 2021: - The panic!() macro now uses format_args!() like println!(). - The usage of panic!(x) is now deprecated if x is not a string literal. See: https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.htmlpull/16/head
parent
0de1d86494
commit
b9a0719750
|
@ -67,7 +67,7 @@ impl EchidnaCoreEditor {
|
|||
|_, _| {},
|
||||
|result| {
|
||||
if result.is_err() {
|
||||
panic!(result.err());
|
||||
panic!("Found an error when loading the file into the text editor's buffer. {:#?}", result.err());
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
@ -114,7 +114,7 @@ impl FileImplementedEditor for super::EchidnaWindow {
|
|||
"Couldn't get the page of the current index. Try again."
|
||||
).downcast::<EchidnaCoreEditor>() {
|
||||
Ok(res) => page = res,
|
||||
Err(e) => panic!(format!("We got an error when trying to downcast the current tab page into EchidnaCoreEditor:\n{}", e))
|
||||
Err(e) => panic!("We got an error when trying to downcast the current tab page into EchidnaCoreEditor:\n{}", e)
|
||||
}
|
||||
|
||||
let buffer: Buffer = page.to_imp().sourceview.buffer().downcast().expect("Could not downcast the editor's buffer to GtkSourceBuffer.");
|
||||
|
@ -129,7 +129,7 @@ impl FileImplementedEditor for super::EchidnaWindow {
|
|||
|_, _| {},
|
||||
|result| {
|
||||
if result.is_err() {
|
||||
panic!(format!("Found an error while saving the file:\n{}", result.err().expect("No error")))
|
||||
panic!("Found an error while saving the file:\n{}", result.err().expect("No error"))
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue