From 84ea6bfc719d136bdf6d5725fec73b6ede9b3922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 27 Jul 2019 13:56:01 +0200 Subject: [PATCH] Fix beta build warnings / errors. (#1603) Fixes #1598 --- src/codegen/error.rs | 2 +- src/codegen/mod.rs | 2 +- src/ir/context.rs | 2 +- src/lib.rs | 8 ++++---- src/options.rs | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/codegen/error.rs b/src/codegen/error.rs index ccb76c5bd7..8bf00e547d 100644 --- a/src/codegen/error.rs +++ b/src/codegen/error.rs @@ -20,7 +20,7 @@ impl fmt::Display for Error { } impl error::Error for Error { - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index e026a3c732..8e1eded25e 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -742,7 +742,7 @@ impl CodeGenerator for Type { .all(|c| match c { // These are the only characters allowed in simple // paths, eg `good::dogs::Bront`. - 'A'...'Z' | 'a'...'z' | '0'...'9' | ':' | '_' | ' ' => true, + 'A'..='Z' | 'a'..='z' | '0'..='9' | ':' | '_' | ' ' => true, _ => false, }) && outer_params.is_empty() && diff --git a/src/ir/context.rs b/src/ir/context.rs index 25c37874e7..6c9810364a 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -661,7 +661,7 @@ If you encounter an error missing from this list, please file an issue or a PR!" } /// Get the user-provided callbacks by reference, if any. - pub fn parse_callbacks(&self) -> Option<&ParseCallbacks> { + pub fn parse_callbacks(&self) -> Option<&dyn ParseCallbacks> { self.options().parse_callbacks.as_ref().map(|t| &**t) } diff --git a/src/lib.rs b/src/lib.rs index 39fa3182e3..b59c9271c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1146,7 +1146,7 @@ impl Builder { /// [`ParseCallbacks`](./callbacks/trait.ParseCallbacks.html) documentation. pub fn parse_callbacks( mut self, - cb: Box, + cb: Box, ) -> Self { self.options.parse_callbacks = Some(cb); self @@ -1500,7 +1500,7 @@ struct BindgenOptions { /// A user-provided visitor to allow customizing different kinds of /// situations. - parse_callbacks: Option>, + parse_callbacks: Option>, /// Which kind of items should we generate? By default, we'll generate all /// of them. @@ -1853,7 +1853,7 @@ impl Bindings { /// Convert these bindings into source text (with raw lines prepended). pub fn to_string(&self) -> String { let mut bytes = vec![]; - self.write(Box::new(&mut bytes) as Box) + self.write(Box::new(&mut bytes) as Box) .expect("writing to a vec cannot fail"); String::from_utf8(bytes) .expect("we should only write bindings that are valid utf-8") @@ -1871,7 +1871,7 @@ impl Bindings { } /// Write these bindings as source text to the given `Write`able. - pub fn write<'a>(&self, mut writer: Box) -> io::Result<()> { + pub fn write<'a>(&self, mut writer: Box) -> io::Result<()> { writer.write( "/* automatically generated by rust-bindgen */\n\n".as_bytes(), )?; diff --git a/src/options.rs b/src/options.rs index 43ad2edc42..d15cba8172 100644 --- a/src/options.rs +++ b/src/options.rs @@ -8,7 +8,7 @@ use std::str::FromStr; /// Construct a new [`Builder`](./struct.Builder.html) from command line flags. pub fn builder_from_flags( args: I, -) -> Result<(Builder, Box, bool), io::Error> +) -> Result<(Builder, Box, bool), io::Error> where I: Iterator, { @@ -600,9 +600,9 @@ where let output = if let Some(path) = matches.value_of("output") { let file = File::create(path)?; - Box::new(io::BufWriter::new(file)) as Box + Box::new(io::BufWriter::new(file)) as Box } else { - Box::new(io::BufWriter::new(io::stdout())) as Box + Box::new(io::BufWriter::new(io::stdout())) as Box }; if matches.is_present("dump-preprocessed-input") {