Skip to content

Commit 24cfccd

Browse files
MikuroXinaemilio
authored andcommitted
Remove deprecation and Replace
1 parent 5685440 commit 24cfccd

File tree

7 files changed

+20
-26
lines changed

7 files changed

+20
-26
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
```Rust
2525
bindgen::Builder::default()
2626
.header("input.h")
27-
.gen()
27+
.generate()
2828
.unwrap()
2929
```
3030

bindgen-integration/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn main() {
185185
.constified_enum("my_prefixed_enum_to_be_constified")
186186
.opaque_type("my_prefixed_templated_foo<my_prefixed_baz>")
187187
.depfile(out_rust_file_relative.display().to_string(), &out_dep_file)
188-
.gen()
188+
.generate()
189189
.expect("Unable to generate bindings");
190190

191191
assert!(macros.read().unwrap().contains("TESTMACRO"));

book/src/tutorial-3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() {
3232
// included header files changed.
3333
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
3434
// Finish the builder and generate the bindings.
35-
.gen()
35+
.generate()
3636
// Unwrap the Result and panic on failure.
3737
.expect("Unable to generate bindings");
3838

src/lib.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl Default for CodegenConfig {
180180
/// let bindings = builder().header("path/to/input/header")
181181
/// .allowlist_type("SomeCoolClass")
182182
/// .allowlist_function("do_some_cool_thing")
183-
/// .gen()?;
183+
/// .generate()?;
184184
///
185185
/// // Write the generated bindings to an output file.
186186
/// bindings.write_to_file("path/to/output.rs")?;
@@ -247,7 +247,7 @@ impl Builder {
247247

248248
// FIXME(emilio): This is a bit hacky, maybe we should stop re-using the
249249
// RustFeatures to store the "disable_untagged_union" call, and make it
250-
// a different flag that we check elsewhere / in gen().
250+
// a different flag that we check elsewhere / in generate().
251251
if !self.options.rust_features.untagged_union &&
252252
RustFeatures::from(self.options.rust_target).untagged_union
253253
{
@@ -595,7 +595,7 @@ impl Builder {
595595
/// ```ignore
596596
/// let bindings = bindgen::Builder::default()
597597
/// .header("input.h")
598-
/// .gen()
598+
/// .generate()
599599
/// .unwrap();
600600
/// ```
601601
///
@@ -607,7 +607,7 @@ impl Builder {
607607
/// .header("first.h")
608608
/// .header("second.h")
609609
/// .header("third.h")
610-
/// .gen()
610+
/// .generate()
611611
/// .unwrap();
612612
/// ```
613613
pub fn header<T: Into<String>>(mut self, header: T) -> Builder {
@@ -1444,13 +1444,7 @@ impl Builder {
14441444
}
14451445

14461446
/// Generate the Rust bindings using the options built up thus far.
1447-
#[deprecated(since = "0.59.3", note = "please use `gen` instead")]
1448-
pub fn generate(self) -> Result<Bindings, ()> {
1449-
self.gen().map_err(|_| ())
1450-
}
1451-
1452-
/// Generate the Rust bindings using the options built up thus far, or `Err` on failure.
1453-
pub fn gen(mut self) -> Result<Bindings, BindgenError> {
1447+
pub fn generate(mut self) -> Result<Bindings, BindgenError> {
14541448
// Add any extra arguments from the environment to the clang command line.
14551449
if let Some(extra_clang_args) =
14561450
get_target_dependent_env_var("BINDGEN_EXTRA_CLANG_ARGS")
@@ -2697,7 +2691,7 @@ fn get_target_dependent_env_var(var: &str) -> Option<String> {
26972691
/// let bindings = builder()
26982692
/// .header("path/to/input/header")
26992693
/// .parse_callbacks(Box::new(bindgen::CargoCallbacks))
2700-
/// .gen();
2694+
/// .generate();
27012695
/// ```
27022696
#[derive(Debug)]
27032697
pub struct CargoCallbacks;

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn main() {
4949
Ok((builder, output, verbose)) => {
5050
clang_version_check();
5151
let builder_result = panic::catch_unwind(|| {
52-
builder.gen().expect("Unable to generate bindings")
52+
builder.generate().expect("Unable to generate bindings")
5353
});
5454

5555
if builder_result.is_err() {
@@ -99,7 +99,7 @@ mod test {
9999
let (builder, _output, _verbose) =
100100
crate::options::builder_from_flags(command_line_flags.into_iter())
101101
.unwrap();
102-
builder.gen().expect("failed to generate bindings");
102+
builder.generate().expect("failed to generate bindings");
103103
}
104104

105105
#[test]

tests/stylo_sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ fn sanity_check_can_generate_stylo_bindings() {
540540
.clang_arg("-DMOZ_STYLO")
541541
.clang_arg("-DOS_POSIX=1")
542542
.clang_arg("-DOS_LINUX=1")
543-
.gen()
543+
.generate()
544544
.expect("Should generate stylo bindings");
545545

546546
let now = Instant::now();

tests/tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ fn compare_generated_header(
193193

194194
let (builder, roundtrip_builder) = builder.into_builder(check_roundtrip)?;
195195

196-
// We skip the gen() error here so we get a full diff below
197-
let (actual, rustfmt_stderr) = match builder.gen() {
196+
// We skip the generate() error here so we get a full diff below
197+
let (actual, rustfmt_stderr) = match builder.generate() {
198198
Ok(bindings) => {
199199
let actual = bindings.to_string();
200200
rustfmt(actual)
@@ -426,7 +426,7 @@ fn test_clang_env_args() {
426426
#ifdef _ENV_TWO\nextern const int y[] = { 42 };\n#endif\n\
427427
#ifdef NOT_THREE\nextern const int z[] = { 42 };\n#endif\n",
428428
)
429-
.gen()
429+
.generate()
430430
.unwrap()
431431
.to_string();
432432

@@ -453,7 +453,7 @@ fn test_header_contents() {
453453
.disable_header_comment()
454454
.header_contents("test.h", "int foo(const char* a);")
455455
.clang_arg("--target=x86_64-unknown-linux")
456-
.gen()
456+
.generate()
457457
.unwrap()
458458
.to_string();
459459

@@ -480,7 +480,7 @@ fn test_multiple_header_calls_in_builder() {
480480
))
481481
.header(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/headers/char.h"))
482482
.clang_arg("--target=x86_64-unknown-linux")
483-
.gen()
483+
.generate()
484484
.unwrap()
485485
.to_string();
486486

@@ -514,7 +514,7 @@ fn test_multiple_header_contents() {
514514
.header_contents("test.h", "int foo(const char* a);")
515515
.header_contents("test2.h", "float foo2(const char* b);")
516516
.clang_arg("--target=x86_64-unknown-linux")
517-
.gen()
517+
.generate()
518518
.unwrap()
519519
.to_string();
520520

@@ -546,7 +546,7 @@ fn test_mixed_header_and_header_contents() {
546546
.header_contents("test.h", "int bar(const char* a);")
547547
.header_contents("test2.h", "float bar2(const char* b);")
548548
.clang_arg("--target=x86_64-unknown-linux")
549-
.gen()
549+
.generate()
550550
.unwrap()
551551
.to_string();
552552

@@ -596,7 +596,7 @@ fn emit_depfile() {
596596
env::var_os("BINDGEN_DISABLE_ROUNDTRIP_TEST").is_none();
597597
let (builder, _roundtrip_builder) =
598598
builder.into_builder(check_roundtrip).unwrap();
599-
let _bindings = builder.gen().unwrap();
599+
let _bindings = builder.generate().unwrap();
600600

601601
let observed = std::fs::read_to_string(observed_depfile).unwrap();
602602
let expected = std::fs::read_to_string(expected_depfile).unwrap();

0 commit comments

Comments
 (0)