Skip to content

Commit

Permalink
Fix beta build warnings / errors. (#1603)
Browse files Browse the repository at this point in the history
Fixes #1598
  • Loading branch information
emilio authored Jul 27, 2019
1 parent 37e3d65 commit 84ea6bf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/codegen/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down
2 changes: 1 addition & 1 deletion src/ir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ impl Builder {
/// [`ParseCallbacks`](./callbacks/trait.ParseCallbacks.html) documentation.
pub fn parse_callbacks(
mut self,
cb: Box<callbacks::ParseCallbacks>,
cb: Box<dyn callbacks::ParseCallbacks>,
) -> Self {
self.options.parse_callbacks = Some(cb);
self
Expand Down Expand Up @@ -1500,7 +1500,7 @@ struct BindgenOptions {

/// A user-provided visitor to allow customizing different kinds of
/// situations.
parse_callbacks: Option<Box<callbacks::ParseCallbacks>>,
parse_callbacks: Option<Box<dyn callbacks::ParseCallbacks>>,

/// Which kind of items should we generate? By default, we'll generate all
/// of them.
Expand Down Expand Up @@ -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<Write>)
self.write(Box::new(&mut bytes) as Box<dyn Write>)
.expect("writing to a vec cannot fail");
String::from_utf8(bytes)
.expect("we should only write bindings that are valid utf-8")
Expand All @@ -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<Write + 'a>) -> io::Result<()> {
pub fn write<'a>(&self, mut writer: Box<dyn Write + 'a>) -> io::Result<()> {
writer.write(
"/* automatically generated by rust-bindgen */\n\n".as_bytes(),
)?;
Expand Down
6 changes: 3 additions & 3 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::str::FromStr;
/// Construct a new [`Builder`](./struct.Builder.html) from command line flags.
pub fn builder_from_flags<I>(
args: I,
) -> Result<(Builder, Box<io::Write>, bool), io::Error>
) -> Result<(Builder, Box<dyn io::Write>, bool), io::Error>
where
I: Iterator<Item = String>,
{
Expand Down Expand Up @@ -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<io::Write>
Box::new(io::BufWriter::new(file)) as Box<dyn io::Write>
} else {
Box::new(io::BufWriter::new(io::stdout())) as Box<io::Write>
Box::new(io::BufWriter::new(io::stdout())) as Box<dyn io::Write>
};

if matches.is_present("dump-preprocessed-input") {
Expand Down

0 comments on commit 84ea6bf

Please sign in to comment.