Run cargo fix --edition-idioms

This commit is contained in:
Nick Mathewson 2020-12-02 15:14:29 -05:00
parent aebf1fcc0d
commit 01de0cafc5
9 changed files with 15 additions and 15 deletions

View File

@ -230,7 +230,7 @@ pub enum Error {
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::InvalidInteger => write!(f, "Integer was not member of this enumeration"),
Error::InvalidString => write!(f, "String was not member of this enumeration"),

View File

@ -253,7 +253,7 @@ mod test {
impl AsyncRead for FakeConnection {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context,
_cx: &mut Context<'_>,
_buf: &mut [u8],
) -> Poll<std::result::Result<usize, std::io::Error>> {
Poll::Ready(Ok(0))
@ -262,20 +262,20 @@ mod test {
impl AsyncWrite for FakeConnection {
fn poll_write(
self: Pin<&mut Self>,
_cx: &mut Context,
_cx: &mut Context<'_>,
_buf: &[u8],
) -> Poll<std::result::Result<usize, std::io::Error>> {
Poll::Ready(Ok(0))
}
fn poll_flush(
self: Pin<&mut Self>,
_cx: &mut Context,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), std::io::Error>> {
Poll::Ready(Ok(()))
}
fn poll_close(
self: Pin<&mut Self>,
_cx: &mut Context,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), std::io::Error>> {
Poll::Ready(Ok(()))
}

View File

@ -97,7 +97,7 @@ impl PartialEq<Ed25519Identity> for Ed25519Identity {
impl Eq for Ed25519Identity {}
impl Display for Ed25519Identity {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
@ -107,7 +107,7 @@ impl Display for Ed25519Identity {
}
impl Debug for Ed25519Identity {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "Ed25519Identity {{ {} }}", self)
}
}

View File

@ -333,7 +333,7 @@ lemon
8J+Niw==
-----END LEMON-----
";
let mut r: NetDocReader<Fruit> = NetDocReader::new(s);
let mut r: NetDocReader<'_, Fruit> = NetDocReader::new(s);
let sec = FRUIT_SALAD.parse(&mut r.iter()).unwrap();
assert_eq!(sec.required(ANN_TASTY)?.arg(0), Some("yes"));
@ -370,7 +370,7 @@ lemon
fn rejected() {
use crate::Pos;
fn check(s: &str, e: Error) {
let mut r: NetDocReader<Fruit> = NetDocReader::new(s);
let mut r: NetDocReader<'_, Fruit> = NetDocReader::new(s);
let res = FRUIT_SALAD.parse(&mut r.iter());
assert!(res.is_err());
assert_eq!(res.err().unwrap().within(s), e);

View File

@ -668,7 +668,7 @@ cherry 6
-----END CHERRY SYNOPSIS-----
plum hello there
";
let mut r: NetDocReader<Fruit> = NetDocReader::new(s);
let mut r: NetDocReader<'_, Fruit> = NetDocReader::new(s);
assert_eq!(r.str(), s);
assert!(r.should_be_exhausted().is_err()); // it's not exhausted.
@ -749,7 +749,7 @@ cherry
truncated line";
let mut r: NetDocReader<Fruit> = NetDocReader::new(s);
let mut r: NetDocReader<'_, Fruit> = NetDocReader::new(s);
let toks: Vec<_> = r.iter().collect();
assert!(toks[0].is_err());

View File

@ -27,7 +27,7 @@ impl UniqId {
}
impl Display for UniqId {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Chan {}", self.0)
}
}

View File

@ -58,7 +58,7 @@ pub(super) enum CtrlMsg {
}
impl std::fmt::Debug for CtrlMsg {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use CtrlMsg::*;
match self {
Shutdown => write!(f, "Shutdown"),

View File

@ -24,7 +24,7 @@ impl UniqId {
}
impl Display for UniqId {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Circ {}.{}", self.chan, self.circ)
}
}

View File

@ -184,7 +184,7 @@ impl SocksRequest {
impl fmt::Display for SocksAddr {
/// Format a string (a hostname or IP address) corresponding to this
/// SocksAddr.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SocksAddr::Ip(a) => write!(f, "{}", a),
SocksAddr::Hostname(h) => write!(f, "{}", h),