[gnome-builder] meson-templates: Format Rust files and add exit code
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] meson-templates: Format Rust files and add exit code
- Date: Thu, 13 Feb 2020 02:19:18 +0000 (UTC)
commit b44ff17fb60fe9d64794bdd908a323bfbad12ab0
Author: Ricardo Silva Veloso <ricvelozo gmail com>
Date: Mon Feb 10 08:02:35 2020 -0300
meson-templates: Format Rust files and add exit code
src/plugins/meson-templates/resources/src/main.rs | 14 +++++---------
src/plugins/meson-templates/resources/src/meson-rs.build | 1 +
src/plugins/meson-templates/resources/src/window.rs | 11 ++++-------
3 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/plugins/meson-templates/resources/src/main.rs
b/src/plugins/meson-templates/resources/src/main.rs
index 86b55d8aa..dc5934574 100644
--- a/src/plugins/meson-templates/resources/src/main.rs
+++ b/src/plugins/meson-templates/resources/src/main.rs
@@ -1,7 +1,6 @@
-use gtk::prelude::*;
-use gio::prelude::*;
use gettextrs::*;
-use std::env;
+use gio::prelude::*;
+use gtk::prelude::*;
mod config;
mod window;
@@ -15,7 +14,7 @@ fn main() {
textdomain("{{name}}");
let res = gio::Resource::load(config::PKGDATADIR.to_owned() + "/{{name}}.gresource")
- .expect("Could not load resources");
+ .expect("Could not load resources");
gio::resources_register(&res);
let app = gtk::Application::new(Some("{{appid}}"), Default::default()).unwrap();
@@ -27,9 +26,6 @@ fn main() {
window.widget.present();
});
-
- let args: Vec<String> = env::args().collect();
- app.run(&args);
-
+ let ret = app.run(&std::env::args().collect::<Vec<_>>());
+ std::process::exit(ret);
}
-
diff --git a/src/plugins/meson-templates/resources/src/meson-rs.build
b/src/plugins/meson-templates/resources/src/meson-rs.build
index e5e34c926..f7d105d37 100644
--- a/src/plugins/meson-templates/resources/src/meson-rs.build
+++ b/src/plugins/meson-templates/resources/src/meson-rs.build
@@ -18,6 +18,7 @@ configure_file(
output: 'config.rs',
configuration: conf
)
+
# Copy the config.rs output to the source directory.
run_command(
'cp',
diff --git a/src/plugins/meson-templates/resources/src/window.rs
b/src/plugins/meson-templates/resources/src/window.rs
index a2af97e90..a535a1666 100644
--- a/src/plugins/meson-templates/resources/src/window.rs
+++ b/src/plugins/meson-templates/resources/src/window.rs
@@ -5,15 +5,12 @@ pub struct Window {
}
impl Window {
-
pub fn new() -> Self {
let builder = gtk::Builder::new_from_resource("{{appid_path}}/{{ui_file}}");
- let widget: gtk::ApplicationWindow = builder.get_object("window").expect("Failed to find the window
object");
+ let widget: gtk::ApplicationWindow = builder
+ .get_object("window")
+ .expect("Failed to find the window object");
- Self {
- widget,
- }
+ Self { widget }
}
-
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]