summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs30
-rw-r--r--src/options.rs24
2 files changed, 29 insertions, 25 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 431fea0e..1f18d680 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -456,13 +456,16 @@ impl Builder {
);
}
- if !self.options.format_bindings {
- output_vector.push("--format-bindings".into());
+ if !self.options.rustfmt_bindings {
+ output_vector.push("--rustfmt-bindings".into());
}
- if let Some(path) = self.options.format_configuration_file.as_ref().and_then(
- |f| f.to_str()) {
- output_vector.push("--format-configuration-file".into());
+ if let Some(path) = self.options
+ .rustfmt_configuration_file
+ .as_ref()
+ .and_then(|f| f.to_str())
+ {
+ output_vector.push("--rustfmt-configuration-file".into());
output_vector.push(path.into());
}
@@ -852,15 +855,16 @@ impl Builder {
}
/// Set whether rustfmt should format the generated bindings.
- pub fn format_bindings(mut self, doit: bool) -> Self {
- self.options.format_bindings = doit;
+ pub fn rustfmt_bindings(mut self, doit: bool) -> Self {
+ self.options.rustfmt_bindings = doit;
self
}
/// Set the absolute path to the rustfmt configuration file, if None, the standard rustfmt
/// options are used.
- pub fn format_configuration_file(mut self, path: Option<PathBuf>) -> Self {
- self.options.format_configuration_file = path;
+ pub fn rustfmt_configuration_file(mut self, path: Option<PathBuf>) -> Self {
+ self = self.rustfmt_bindings(true);
+ self.options.rustfmt_configuration_file = path;
self
}
@@ -1125,11 +1129,11 @@ pub struct BindgenOptions {
rust_features: RustFeatures,
/// Whether rustfmt should format the generated bindings.
- pub format_bindings: bool,
+ pub rustfmt_bindings: bool,
/// The absolute path to the rustfmt configuration file, if None, the standard rustfmt
/// options are used.
- pub format_configuration_file: Option<PathBuf>,
+ pub rustfmt_configuration_file: Option<PathBuf>,
}
/// TODO(emilio): This is sort of a lie (see the error message that results from
@@ -1214,8 +1218,8 @@ impl Default for BindgenOptions {
objc_extern_crate: false,
enable_mangling: true,
prepend_enum_name: true,
- format_bindings: true,
- format_configuration_file: None,
+ rustfmt_bindings: true,
+ rustfmt_configuration_file: None,
}
}
}
diff --git a/src/options.rs b/src/options.rs
index 074807c8..7b5169b7 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -233,15 +233,15 @@ where
Useful when debugging bindgen, using C-Reduce, or when \
filing issues. The resulting file will be named \
something like `__bindgen.i` or `__bindgen.ii`."),
- Arg::with_name("format-bindings")
- .long("format-bindings")
+ Arg::with_name("rustfmt-bindings")
+ .long("rustfmt-bindings")
.help("Format the generated bindings with rustfmt. \
Rustfmt needs to be in the global PATH."),
- Arg::with_name("format-configuration-file")
- .long("format-configuration-file")
+ Arg::with_name("rustfmt-configuration-file")
+ .long("rustfmt-configuration-file")
.help("The absolute path to the rustfmt configuration file. \
- The configuration file will be used for formatting the bindings \
- (when enabled by --format-bindings).")
+ The configuration file will be used for formatting the bindings. \
+ Setting this parameter, will automatically set --rustfmt-bindings.")
.value_name("path")
.takes_value(true)
.multiple(false)
@@ -472,25 +472,25 @@ where
builder.dump_preprocessed_input()?;
}
- if matches.is_present("format-bindings") {
- builder = builder.format_bindings(true);
+ if matches.is_present("rustfmt-bindings") {
+ builder = builder.rustfmt_bindings(true);
}
- if let Some(path_str) = matches.value_of("format-configuration-file") {
+ if let Some(path_str) = matches.value_of("rustfmt-configuration-file") {
let path = PathBuf::from(path_str);
if !path.is_absolute() {
return Err(Error::new(ErrorKind::Other,
- "--format-configuration--file needs to be an absolute path!"));
+ "--rustfmt-configuration--file needs to be an absolute path!"));
}
if path.to_str().is_none() {
return Err(
Error::new(ErrorKind::Other,
- "--format-configuration-file contains non-valid UTF8 characters."));
+ "--rustfmt-configuration-file contains non-valid UTF8 characters."));
}
- builder = builder.format_configuration_file(Some(path));
+ builder = builder.rustfmt_configuration_file(Some(path));
}
let verbose = matches.is_present("verbose");