Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit 7828a06

Browse files
Merge pull request #827 from sdroege/rustfmt
Format code with rustfmt
2 parents d84be1a + 6ab6d30 commit 7828a06

File tree

259 files changed

+45509
-16495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+45509
-16495
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ before_install:
5252
script:
5353
- rustc --version
5454
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ] && [ "$GTK" == "3.14" ]; then
55+
rustup component add rustfmt;
5556
make regen_check;
5657
fi
5758
- ./check_init_asserts

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GIR_FILES = gir-files/Gtk-3.0.gir
55

66
# Run `gir` generating the bindings
77
gir : src/auto/mod.rs
8+
cargo fmt
89

910
doc: $(GIR) $(GIR_FILES)
1011
$(GIR) -m doc -c Gir.toml
@@ -15,6 +16,7 @@ not_bound: $(GIR) $(GIR_FILES)
1516
regen_check: $(GIR) $(GIR_FILES)
1617
rm src/auto/*
1718
$(GIR) -c Gir.toml
19+
cargo fmt
1820
git diff -R --exit-code
1921

2022
src/auto/mod.rs : Gir.toml $(GIR) $(GIR_FILES)

build.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,24 @@ fn main() {
88
}
99

1010
#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))]
11-
fn manage_docs () {
11+
fn manage_docs() {
1212
extern crate lgpl_docs;
1313
const PATH: &'static str = "src";
14-
const IGNORES: &'static [&'static str] = &[
15-
"lib.rs",
16-
"prelude.rs",
17-
"rt.rs",
18-
"signal.rs",
19-
];
14+
const IGNORES: &'static [&'static str] = &["lib.rs", "prelude.rs", "rt.rs", "signal.rs"];
2015
lgpl_docs::purge(PATH, IGNORES);
2116
if cfg!(feature = "embed-lgpl-docs") {
2217
lgpl_docs::embed(lgpl_docs::Library::Gtk, PATH, IGNORES);
2318
}
2419
}
2520

2621
#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))]
27-
fn manage_docs() { }
22+
fn manage_docs() {}
2823

2924
#[cfg(target_os = "macos")]
3025
fn build_foreground() {
31-
cc::Build::new().file("src/foreground.m").compile("foreground");
26+
cc::Build::new()
27+
.file("src/foreground.m")
28+
.compile("foreground");
3229
println!("cargo:rustc-link-lib=framework=AppKit");
3330
println!("cargo:rustc-link-lib=framework=CoreFoundation");
3431
}

src/app_chooser.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ pub trait AppChooserExt: 'static {
2424

2525
impl<O: IsA<AppChooser>> AppChooserExt for O {
2626
fn get_app_info(&self) -> Option<AppInfo> {
27-
unsafe { from_glib_full(gtk_sys::gtk_app_chooser_get_app_info(self.as_ref().to_glib_none().0)) }
27+
unsafe {
28+
from_glib_full(gtk_sys::gtk_app_chooser_get_app_info(
29+
self.as_ref().to_glib_none().0,
30+
))
31+
}
2832
}
2933

3034
fn get_content_type(&self) -> Option<String> {
3135
unsafe {
32-
from_glib_full(
33-
gtk_sys::gtk_app_chooser_get_content_type(self.as_ref().to_glib_none().0))
36+
from_glib_full(gtk_sys::gtk_app_chooser_get_content_type(
37+
self.as_ref().to_glib_none().0,
38+
))
3439
}
3540
}
3641

src/application.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
use gio::ApplicationFlags;
22
use glib;
33
use glib::translate::*;
4-
use rt;
54
use gtk_sys;
5+
use rt;
66
use Application;
77

88
impl Application {
9-
pub fn new(application_id: Option<&str>, flags: ApplicationFlags) -> Result<Application, glib::BoolError> {
9+
pub fn new(
10+
application_id: Option<&str>,
11+
flags: ApplicationFlags,
12+
) -> Result<Application, glib::BoolError> {
1013
skip_assert_initialized!();
1114
try!(rt::init());
1215
unsafe {
13-
Option::from_glib_full(
14-
gtk_sys::gtk_application_new(application_id.to_glib_none().0, flags.to_glib())
15-
)
16+
Option::from_glib_full(gtk_sys::gtk_application_new(
17+
application_id.to_glib_none().0,
18+
flags.to_glib(),
19+
))
1620
.ok_or_else(|| glib_bool_error!("Failed to create application"))
1721
}
1822
}

src/application_window.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ impl ApplicationWindow {
1010
pub fn new<P: IsA<Application>>(application: &P) -> ApplicationWindow {
1111
skip_assert_initialized!();
1212
unsafe {
13-
Widget::from_glib_none(gtk_sys::gtk_application_window_new(application.as_ref().to_glib_none().0)).unsafe_cast()
13+
Widget::from_glib_none(gtk_sys::gtk_application_window_new(
14+
application.as_ref().to_glib_none().0,
15+
))
16+
.unsafe_cast()
1417
}
1518
}
1619
}

0 commit comments

Comments
 (0)