Skip to content

Commit 6afec70

Browse files
author
bors-servo
authored
Auto merge of #235 - emilio:refmt, r=fitzgen
Reformat Automatic reformat running `cargo fmt` for the latest nits introduced. r? @fitzgen
2 parents 7e02c20 + 1f9ac5c commit 6afec70

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

src/bin/options.rs

+26-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
use std::fs::File;
2-
use std::io::{self, Error, ErrorKind};
31

4-
use clap::{App, Arg};
52

6-
use bindgen::{builder, Builder};
3+
use bindgen::{Builder, builder};
4+
5+
use clap::{App, Arg};
6+
use std::fs::File;
7+
use std::io::{self, Error, ErrorKind};
78

89
/// Construct a new [`Builder`](./struct.Builder.html) from command line flags.
9-
pub fn builder_from_flags<I>(args: I) -> Result<(Builder, Box<io::Write>), io::Error>
10-
where I: Iterator<Item=String>
10+
pub fn builder_from_flags<I>(args: I)
11+
-> Result<(Builder, Box<io::Write>), io::Error>
12+
where I: Iterator<Item = String>,
1113
{
1214
let matches = App::new("bindgen")
1315
.version(env!("CARGO_PKG_VERSION"))
@@ -19,7 +21,8 @@ pub fn builder_from_flags<I>(args: I) -> Result<(Builder, Box<io::Write>), io::E
1921
.required(true),
2022
Arg::with_name("bitfield-enum")
2123
.long("bitfield-enum")
22-
.help("Mark any enum whose name matches <regex> as a set of bitfield flags instead of an enumeration.")
24+
.help("Mark any enum whose name matches <regex> as a set of \
25+
bitfield flags instead of an enumeration.")
2326
.value_name("regex")
2427
.takes_value(true)
2528
.multiple(true)
@@ -33,18 +36,21 @@ pub fn builder_from_flags<I>(args: I) -> Result<(Builder, Box<io::Write>), io::E
3336
.number_of_values(1),
3437
Arg::with_name("builtins")
3538
.long("builtins")
36-
.help("Output bindings for builtin definitions, e.g. __builtin_va_list."),
39+
.help("Output bindings for builtin definitions, e.g. \
40+
__builtin_va_list."),
3741
Arg::with_name("ctypes-prefix")
3842
.long("ctypes-prefix")
39-
.help("Use the given prefix before raw types instead of ::std::os::raw.")
43+
.help("Use the given prefix before raw types instead of \
44+
::std::os::raw.")
4045
.value_name("prefix")
4146
.takes_value(true),
4247
// All positional arguments after the end of options marker, `--`
4348
Arg::with_name("clang-args")
4449
.multiple(true),
4550
Arg::with_name("dummy-uses")
4651
.long("dummy-uses")
47-
.help("For testing purposes, generate a C/C++ file containing dummy uses of all types defined in the input header.")
52+
.help("For testing purposes, generate a C/C++ file containing \
53+
dummy uses of all types defined in the input header.")
4854
.takes_value(true),
4955
Arg::with_name("emit-clang-ast")
5056
.long("emit-clang-ast")
@@ -60,7 +66,8 @@ pub fn builder_from_flags<I>(args: I) -> Result<(Builder, Box<io::Write>), io::E
6066
.number_of_values(1),
6167
Arg::with_name("ignore-functions")
6268
.long("ignore-functions")
63-
.help("Do not generate bindings for functions or methods. This is useful when you only care about struct layouts."),
69+
.help("Do not generate bindings for functions or methods. This \
70+
is useful when you only care about struct layouts."),
6471
Arg::with_name("ignore-methods")
6572
.long("ignore-methods")
6673
.help("Do not generate bindings for methods."),
@@ -110,21 +117,26 @@ pub fn builder_from_flags<I>(args: I) -> Result<(Builder, Box<io::Write>), io::E
110117
.help("MSVC C++ ABI mangling. DEPRECATED: Has no effect."),
111118
Arg::with_name("whitelist-function")
112119
.long("whitelist-function")
113-
.help("Whitelist all the free-standing functions matching <regex>. Other non-whitelisted functions will not be generated.")
120+
.help("Whitelist all the free-standing functions matching \
121+
<regex>. Other non-whitelisted functions will not be \
122+
generated.")
114123
.value_name("regex")
115124
.takes_value(true)
116125
.multiple(true)
117126
.number_of_values(1),
118127
Arg::with_name("whitelist-type")
119128
.long("whitelist-type")
120-
.help("Whitelist the type. Other non-whitelisted types will not be generated.")
129+
.help("Whitelist the type. Other non-whitelisted types will \
130+
not be generated.")
121131
.value_name("type")
122132
.takes_value(true)
123133
.multiple(true)
124134
.number_of_values(1),
125135
Arg::with_name("whitelist-var")
126136
.long("whitelist-var")
127-
.help("Whitelist all the free-standing variables matching <regex>. Other non-whitelisted variables will not be generated.")
137+
.help("Whitelist all the free-standing variables matching \
138+
<regex>. Other non-whitelisted variables will not be \
139+
generated.")
128140
.value_name("regex")
129141
.takes_value(true)
130142
.multiple(true)

src/ir/var.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ impl ClangSubItemParser for Var {
111111
EvalResult::Invalid => return Err(ParseError::Continue),
112112

113113
EvalResult::Int(Wrapping(value)) => {
114-
let kind = ctx.options().type_chooser.as_ref()
114+
let kind = ctx.options()
115+
.type_chooser
116+
.as_ref()
115117
.and_then(|c| c.int_macro(&name, value))
116118
.unwrap_or_else(|| {
117119
if value < 0 {

0 commit comments

Comments
 (0)