Skip to content

Commit

Permalink
Deny bare trait objects in src/libterm
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Jul 12, 2018
1 parent c946c25 commit 7407a78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/libterm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![deny(bare_trait_objects)]
#![deny(missing_docs)]

#![cfg_attr(windows, feature(libc))]
Expand All @@ -66,9 +67,9 @@ pub mod terminfo;
mod win;

/// Alias for stdout terminals.
pub type StdoutTerminal = Terminal<Output = Stdout> + Send;
pub type StdoutTerminal = dyn Terminal<Output = Stdout> + Send;
/// Alias for stderr terminals.
pub type StderrTerminal = Terminal<Output = Stderr> + Send;
pub type StderrTerminal = dyn Terminal<Output = Stderr> + Send;

#[cfg(not(windows))]
/// Return a Terminal wrapping stdout, or None if a terminal couldn't be
Expand Down
2 changes: 1 addition & 1 deletion src/libterm/terminfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl error::Error for Error {
"failed to create TermInfo"
}

fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
use self::Error::*;
match self {
&IoError(ref e) => Some(e),
Expand Down
6 changes: 3 additions & 3 deletions src/libterm/terminfo/parser/compiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub static stringnames: &'static[&'static str] = &[ "cbt", "_", "cr", "csr", "tb
"OTG3", "OTG1", "OTG4", "OTGR", "OTGL", "OTGU", "OTGD", "OTGH", "OTGV", "OTGC", "meml", "memu",
"box1"];

fn read_le_u16(r: &mut io::Read) -> io::Result<u16> {
fn read_le_u16(r: &mut dyn io::Read) -> io::Result<u16> {
let mut b = [0; 2];
let mut amt = 0;
while amt < b.len() {
Expand All @@ -176,7 +176,7 @@ fn read_le_u16(r: &mut io::Read) -> io::Result<u16> {
Ok((b[0] as u16) | ((b[1] as u16) << 8))
}

fn read_byte(r: &mut io::Read) -> io::Result<u8> {
fn read_byte(r: &mut dyn io::Read) -> io::Result<u8> {
match r.bytes().next() {
Some(s) => s,
None => Err(io::Error::new(io::ErrorKind::Other, "end of file")),
Expand All @@ -185,7 +185,7 @@ fn read_byte(r: &mut io::Read) -> io::Result<u8> {

/// Parse a compiled terminfo entry, using long capability names if `longnames`
/// is true
pub fn parse(file: &mut io::Read, longnames: bool) -> Result<TermInfo, String> {
pub fn parse(file: &mut dyn io::Read, longnames: bool) -> Result<TermInfo, String> {
macro_rules! t( ($e:expr) => (
match $e {
Ok(e) => e,
Expand Down

0 comments on commit 7407a78

Please sign in to comment.