linters: Fix clippy issues

Latest clippy version complains about our existing code for the
following reasons:

- trait objects without an explicit `dyn` are deprecated
- `...` range patterns are deprecated
- lint `clippy::const_static_lifetime` has been renamed to
  `clippy::redundant_static_lifetimes`
- unnecessary `unsafe` block
- unneeded return statement

All these issues have been fixed through this patch, and rustfmt has
been run to cleanup potential formatting errors due to those changes.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-08-15 08:41:40 -07:00
parent c8364172a3
commit 658c076eb2
14 changed files with 54 additions and 53 deletions

View File

@@ -57,7 +57,7 @@ struct ConsoleEpollHandler {
mem: GuestMemoryMmap,
interrupt_cb: Arc<VirtioInterrupt>,
in_buffer: Arc<Mutex<VecDeque<u8>>>,
out: Box<io::Write + Send>,
out: Box<dyn io::Write + Send>,
input_queue_evt: EventFd,
output_queue_evt: EventFd,
input_evt: EventFd,
@@ -321,13 +321,13 @@ pub struct Console {
acked_features: u64,
config: Arc<Mutex<VirtioConsoleConfig>>,
input: Arc<ConsoleInput>,
out: Option<Box<io::Write + Send>>,
out: Option<Box<dyn io::Write + Send>>,
}
impl Console {
/// Create a new virtio console device that gets random data from /dev/urandom.
pub fn new(
out: Option<Box<io::Write + Send>>,
out: Option<Box<dyn io::Write + Send>>,
cols: u16,
rows: u16,
) -> io::Result<(Console, Arc<ConsoleInput>)> {