diff --git a/.github/workflows/cbindgen.yml b/.github/workflows/cbindgen.yml index 4d4d54a97..bf2791329 100644 --- a/.github/workflows/cbindgen.yml +++ b/.github/workflows/cbindgen.yml @@ -41,11 +41,11 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.40.0 + toolchain: 1.54.0 - name: Build with minimum supported Rust version run: | - cargo +1.40.0 test nonexistent-test --verbose + cargo +1.54.0 test nonexistent-test --verbose build: diff --git a/CHANGES b/CHANGES index 646fdf050..0e0a7bba8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ +## 0.21.0 + + * Update MSRV to 1.54.0 + * Update clap to 3.1. + * Update heck to 0.4.0 + * unraw identifiers + * Honor documentation_length in Cython. + * Add documentation_style to with short and full options + * Map RawFd to Int + * Respect remove_underscores config when prefixing name to enum + ## 0.20.0 * Add Builder::with_using_namespaces. (#688) diff --git a/Cargo.lock b/Cargo.lock index caa9d1d26..7a1f1b6d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - [[package]] name = "atty" version = "0.2.14" @@ -36,7 +27,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "cbindgen" -version = "0.20.0" +version = "0.21.0" dependencies = [ "clap", "heck", @@ -60,17 +51,17 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "clap" -version = "2.33.3" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" dependencies = [ - "ansi_term", "atty", "bitflags", + "indexmap", + "os_str_bytes", "strsim", + "termcolor", "textwrap", - "unicode-width", - "vec_map", ] [[package]] @@ -101,12 +92,9 @@ checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" [[package]] name = "heck" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" @@ -163,6 +151,21 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "os_str_bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +dependencies = [ + "memchr", +] + [[package]] name = "parking_lot" version = "0.10.2" @@ -340,9 +343,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "strsim" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -370,14 +373,20 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "unicode-width", + "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" + [[package]] name = "toml" version = "0.5.6" @@ -387,30 +396,12 @@ dependencies = [ "serde", ] -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -433,6 +424,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 3030f963f..49fb036b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cbindgen" -version = "0.20.0" +version = "0.21.0" authors = [ "Emilio Cobos Álvarez ", "Jeff Muizelaar ", @@ -21,7 +21,7 @@ exclude = [ travis-ci = { repository = "eqrion/cbindgen" } [dependencies] -clap = { version = "2", optional = true } +clap = { version = "3.1", optional = true } indexmap = "1" log = "0.4" serde = { version = "1.0.103", default-features = false, features = ["derive"]} @@ -30,7 +30,7 @@ tempfile = "3.0" toml = "0.5" proc-macro2 = "1" quote = "1" -heck = "0.3" +heck = "0.4" [dependencies.syn] version = "1.0.3" diff --git a/README.md b/README.md index b33cede83..837f7eca4 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,6 @@ in production: * [milksnake](https://github.com/getsentry/milksnake) * [webrender](https://searchfox.org/mozilla-central/source/gfx/webrender_bindings) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/gfx/webrender_bindings/webrender_ffi_generated.h)) * [stylo](https://searchfox.org/mozilla-central/source/layout/style) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/layout/style/ServoStyleConsts.h)) -* [etesync-rs](https://github.com/etesync/etesync-rs) If you're using `cbindgen` and would like to be added to this list, please open a pull request! diff --git a/src/bindgen/rename.rs b/src/bindgen/rename.rs index 0f6a93e0c..f559289dd 100644 --- a/src/bindgen/rename.rs +++ b/src/bindgen/rename.rs @@ -69,11 +69,11 @@ impl RenameRule { Cow::Owned(match self { RenameRule::None => return Cow::Borrowed(text), - RenameRule::GeckoCase => context.to_str().to_owned() + &text.to_camel_case(), + RenameRule::GeckoCase => context.to_str().to_owned() + &text.to_upper_camel_case(), RenameRule::LowerCase => text.to_lowercase(), RenameRule::UpperCase => text.to_uppercase(), - RenameRule::PascalCase => text.to_camel_case(), - RenameRule::CamelCase => text.to_mixed_case(), + RenameRule::PascalCase => text.to_pascal_case(), + RenameRule::CamelCase => text.to_upper_camel_case(), RenameRule::SnakeCase => text.to_snake_case(), RenameRule::ScreamingSnakeCase => text.to_shouty_snake_case(), RenameRule::QualifiedScreamingSnakeCase => { diff --git a/src/main.rs b/src/main.rs index 3e30ca584..35489c1c4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,14 +20,14 @@ extern crate quote; extern crate syn; extern crate toml; -use clap::{App, Arg, ArgMatches}; +use clap::{Arg, ArgMatches, Command}; mod bindgen; mod logging; use crate::bindgen::{Bindings, Builder, Cargo, Config, Error, Profile, Style}; -fn apply_config_overrides<'a>(config: &mut Config, matches: &ArgMatches<'a>) { +fn apply_config_overrides(config: &mut Config, matches: &ArgMatches) { // We allow specifying a language to override the config default. This is // used by compile-tests. if let Some(lang) = matches.value_of("lang") { @@ -78,7 +78,7 @@ fn apply_config_overrides<'a>(config: &mut Config, matches: &ArgMatches<'a>) { } } -fn load_bindings<'a>(input: &Path, matches: &ArgMatches<'a>) -> Result { +fn load_bindings(input: &Path, matches: &ArgMatches) -> Result { // If a file is specified then we load it as a single source if !input.is_dir() { // Load any config specified or search in the input directory @@ -130,62 +130,62 @@ fn load_bindings<'a>(input: &Path, matches: &ArgMatches<'a>) -> Result