Skip to content

Commit 7407a78

Browse files
committed
Deny bare trait objects in src/libterm
1 parent c946c25 commit 7407a78

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/libterm/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
html_root_url = "https://doc.rust-lang.org/nightly/",
4646
html_playground_url = "https://play.rust-lang.org/",
4747
test(attr(deny(warnings))))]
48+
#![deny(bare_trait_objects)]
4849
#![deny(missing_docs)]
4950

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

6869
/// Alias for stdout terminals.
69-
pub type StdoutTerminal = Terminal<Output = Stdout> + Send;
70+
pub type StdoutTerminal = dyn Terminal<Output = Stdout> + Send;
7071
/// Alias for stderr terminals.
71-
pub type StderrTerminal = Terminal<Output = Stderr> + Send;
72+
pub type StderrTerminal = dyn Terminal<Output = Stderr> + Send;
7273

7374
#[cfg(not(windows))]
7475
/// Return a Terminal wrapping stdout, or None if a terminal couldn't be

src/libterm/terminfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl error::Error for Error {
5858
"failed to create TermInfo"
5959
}
6060

61-
fn cause(&self) -> Option<&error::Error> {
61+
fn cause(&self) -> Option<&dyn error::Error> {
6262
use self::Error::*;
6363
match self {
6464
&IoError(ref e) => Some(e),

src/libterm/terminfo/parser/compiled.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub static stringnames: &'static[&'static str] = &[ "cbt", "_", "cr", "csr", "tb
164164
"OTG3", "OTG1", "OTG4", "OTGR", "OTGL", "OTGU", "OTGD", "OTGH", "OTGV", "OTGC", "meml", "memu",
165165
"box1"];
166166

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

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

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

0 commit comments

Comments
 (0)