diff --git a/src/client/connection.rs b/src/client/connection.rs index 18741c4..b0a8a23 100644 --- a/src/client/connection.rs +++ b/src/client/connection.rs @@ -37,7 +37,7 @@ impl Connection { server_identity.as_ref(), ) { Ok(tls_client_connection) => Some(tls_client_connection), - Err(reason) => return Err(reason), + Err(e) => return Err(e), } } None => None, @@ -52,14 +52,14 @@ impl Connection { pub fn close(&self, cancellable: Option<&Cancellable>) -> Result<(), Error> { if let Some(ref tls_client_connection) = self.tls_client_connection { if !tls_client_connection.is_closed() { - if let Err(reason) = tls_client_connection.close(cancellable) { - return Err(Error::TlsClientConnection(reason)); + if let Err(e) = tls_client_connection.close(cancellable) { + return Err(Error::TlsClientConnection(e)); } } } if !self.socket_connection.is_closed() { - if let Err(reason) = self.socket_connection.close(cancellable) { - return Err(Error::SocketConnection(reason)); + if let Err(e) = self.socket_connection.close(cancellable) { + return Err(Error::SocketConnection(e)); } } Ok(()) @@ -90,7 +90,7 @@ impl Connection { self.server_identity.as_ref(), ) { Ok(tls_client_connection) => Ok(tls_client_connection), - Err(reason) => Err(Error::TlsClientConnection(reason)), + Err(e) => Err(Error::TlsClientConnection(e)), } } } @@ -99,7 +99,7 @@ impl Connection { pub fn rehandshake(&self) -> Result<(), Error> { match self.tls_client_connection()?.handshake(Cancellable::NONE) { Ok(()) => Ok(()), - Err(reason) => Err(Error::Rehandshake(reason)), + Err(e) => Err(Error::Rehandshake(e)), } } } @@ -131,6 +131,6 @@ pub fn new_tls_client_connection( Ok(tls_client_connection) } - Err(reason) => Err(Error::TlsClientConnection(reason)), + Err(e) => Err(Error::TlsClientConnection(e)), } } diff --git a/src/client/response.rs b/src/client/response.rs index b646165..345b262 100644 --- a/src/client/response.rs +++ b/src/client/response.rs @@ -29,7 +29,7 @@ impl Response { Meta::from_stream_async(connection.stream(), priority, cancellable, |result| { callback(match result { Ok(meta) => Ok(Self { connection, meta }), - Err(reason) => Err(Error::Meta(reason)), + Err(e) => Err(Error::Meta(e)), }) }) } diff --git a/src/client/response/data/text.rs b/src/client/response/data/text.rs index ba695ca..4de4654 100644 --- a/src/client/response/data/text.rs +++ b/src/client/response/data/text.rs @@ -44,7 +44,7 @@ impl Text { pub fn from_utf8(buffer: &[u8]) -> Result { match GString::from_utf8(buffer.into()) { Ok(data) => Ok(Self::from_string(&data)), - Err(reason) => Err(Error::Decode(reason)), + Err(e) => Err(Error::Decode(e)), } } @@ -68,7 +68,7 @@ impl Text { }, |result| match result { Ok(buffer) => on_complete(Self::from_utf8(&buffer)), - Err(reason) => on_complete(Err(reason)), + Err(e) => on_complete(Err(e)), }, ); } @@ -111,7 +111,7 @@ pub fn read_all_from_stream_async( // Continue bytes reading read_all_from_stream_async(buffer, stream, cancelable, priority, callback); } - Err(reason) => callback(Err(Error::InputStream(reason))), + Err(e) => callback(Err(Error::InputStream(e))), }, ); } diff --git a/src/client/response/data/text/error.rs b/src/client/response/data/text/error.rs index 423c19c..4a853aa 100644 --- a/src/client/response/data/text/error.rs +++ b/src/client/response/data/text/error.rs @@ -13,11 +13,11 @@ impl Display for Error { Self::BufferOverflow => { write!(f, "Buffer overflow") } - Self::Decode(reason) => { - write!(f, "Decode error: {reason}") + Self::Decode(e) => { + write!(f, "Decode error: {e}") } - Self::InputStream(reason) => { - write!(f, "Input stream read error: {reason}") + Self::InputStream(e) => { + write!(f, "Input stream read error: {e}") } } } diff --git a/src/client/response/error.rs b/src/client/response/error.rs index 9b3afb8..9834190 100644 --- a/src/client/response/error.rs +++ b/src/client/response/error.rs @@ -9,8 +9,8 @@ pub enum Error { impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result { match self { - Self::Meta(reason) => { - write!(f, "Meta read error: {reason}") + Self::Meta(e) => { + write!(f, "Meta read error: {e}") } Self::Stream => { write!(f, "I/O stream error") diff --git a/src/client/response/meta.rs b/src/client/response/meta.rs index 8cca009..42bd4dd 100644 --- a/src/client/response/meta.rs +++ b/src/client/response/meta.rs @@ -45,24 +45,24 @@ impl Meta { // Parse data let data = Data::from_utf8(slice); - if let Err(reason) = data { - return Err(Error::Data(reason)); + if let Err(e) = data { + return Err(Error::Data(e)); } // MIME let mime = Mime::from_utf8(slice); - if let Err(reason) = mime { - return Err(Error::Mime(reason)); + if let Err(e) = mime { + return Err(Error::Mime(e)); } // Status let status = Status::from_utf8(slice); - if let Err(reason) = status { - return Err(Error::Status(reason)); + if let Err(e) = status { + return Err(Error::Status(e)); } Ok(Self { @@ -95,7 +95,7 @@ impl Meta { }, |result| match result { Ok(buffer) => on_complete(Self::from_utf8(&buffer)), - Err(reason) => on_complete(Err(reason)), + Err(e) => on_complete(Err(e)), }, ); } @@ -147,7 +147,7 @@ pub fn read_from_stream_async( // Continue read_from_stream_async(buffer, stream, cancellable, priority, on_complete); } - Err((data, reason)) => on_complete(Err(Error::InputStream(data, reason))), + Err((data, e)) => on_complete(Err(Error::InputStream(data, e))), }, ); } diff --git a/src/client/response/meta/data.rs b/src/client/response/meta/data.rs index 0a67b10..e86af61 100644 --- a/src/client/response/meta/data.rs +++ b/src/client/response/meta/data.rs @@ -52,7 +52,7 @@ impl Data { false => Some(Self { value }), true => None, }), - Err(reason) => Err(Error::Decode(reason)), + Err(e) => Err(Error::Decode(e)), } } None => Err(Error::Protocol), diff --git a/src/client/response/meta/data/error.rs b/src/client/response/meta/data/error.rs index 6681812..49455cd 100644 --- a/src/client/response/meta/data/error.rs +++ b/src/client/response/meta/data/error.rs @@ -9,8 +9,8 @@ pub enum Error { impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result { match self { - Self::Decode(reason) => { - write!(f, "Decode error: {reason}") + Self::Decode(e) => { + write!(f, "Decode error: {e}") } Self::Protocol => { write!(f, "Protocol error") diff --git a/src/client/response/meta/error.rs b/src/client/response/meta/error.rs index 246fd48..55abb24 100644 --- a/src/client/response/meta/error.rs +++ b/src/client/response/meta/error.rs @@ -12,21 +12,21 @@ pub enum Error { impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result { match self { - Self::Data(reason) => { - write!(f, "Data error: {reason}") + Self::Data(e) => { + write!(f, "Data error: {e}") } - Self::InputStream(_, reason) => { + Self::InputStream(_, e) => { // @TODO - write!(f, "Input stream error: {reason}") + write!(f, "Input stream error: {e}") } - Self::Mime(reason) => { - write!(f, "MIME error: {reason}") + Self::Mime(e) => { + write!(f, "MIME error: {e}") } Self::Protocol => { write!(f, "Protocol error") } - Self::Status(reason) => { - write!(f, "Status error: {reason}") + Self::Status(e) => { + write!(f, "Status error: {e}") } } } diff --git a/src/client/response/meta/mime.rs b/src/client/response/meta/mime.rs index 4a4f7f2..c86d627 100644 --- a/src/client/response/meta/mime.rs +++ b/src/client/response/meta/mime.rs @@ -47,7 +47,7 @@ impl Mime { match buffer.get(..if len > MAX_LEN { MAX_LEN } else { len }) { Some(value) => match GString::from_utf8(value.into()) { Ok(string) => Self::from_string(string.as_str()), - Err(reason) => Err(Error::Decode(reason)), + Err(e) => Err(Error::Decode(e)), }, None => Err(Error::Protocol), } diff --git a/src/client/response/meta/mime/error.rs b/src/client/response/meta/mime/error.rs index 5b9eccc..4b66ed2 100644 --- a/src/client/response/meta/mime/error.rs +++ b/src/client/response/meta/mime/error.rs @@ -10,8 +10,8 @@ pub enum Error { impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result { match self { - Self::Decode(reason) => { - write!(f, "Decode error: {reason}") + Self::Decode(e) => { + write!(f, "Decode error: {e}") } Self::Protocol => { write!(f, "Protocol error") diff --git a/src/client/response/meta/status.rs b/src/client/response/meta/status.rs index 5a5062a..c0079f4 100644 --- a/src/client/response/meta/status.rs +++ b/src/client/response/meta/status.rs @@ -43,7 +43,7 @@ impl Status { match buffer.get(0..2) { Some(value) => match GString::from_utf8(value.to_vec()) { Ok(string) => Self::from_string(string.as_str()), - Err(reason) => Err(Error::Decode(reason)), + Err(e) => Err(Error::Decode(e)), }, None => Err(Error::Protocol), } diff --git a/src/client/response/meta/status/error.rs b/src/client/response/meta/status/error.rs index 5b9eccc..4b66ed2 100644 --- a/src/client/response/meta/status/error.rs +++ b/src/client/response/meta/status/error.rs @@ -10,8 +10,8 @@ pub enum Error { impl Display for Error { fn fmt(&self, f: &mut Formatter) -> Result { match self { - Self::Decode(reason) => { - write!(f, "Decode error: {reason}") + Self::Decode(e) => { + write!(f, "Decode error: {e}") } Self::Protocol => { write!(f, "Protocol error") diff --git a/src/client/session.rs b/src/client/session.rs index 9e7d1ad..4b138f6 100644 --- a/src/client/session.rs +++ b/src/client/session.rs @@ -69,8 +69,8 @@ impl Session { } // Close connection if active yet - if let Err(reason) = connection.close(Cancellable::NONE) { - return Err(Error::Connection(reason)); + if let Err(e) = connection.close(Cancellable::NONE) { + return Err(Error::Connection(e)); } } Ok(()) diff --git a/src/gio/memory_input_stream.rs b/src/gio/memory_input_stream.rs index 6c451d0..fc175e0 100644 --- a/src/gio/memory_input_stream.rs +++ b/src/gio/memory_input_stream.rs @@ -84,8 +84,8 @@ pub fn read_all_from_stream_async( (on_chunk, on_complete), ); } - Err(reason) => { - on_complete(Err(Error::InputStream(reason))); + Err(e) => { + on_complete(Err(Error::InputStream(e))); } }, ); diff --git a/src/gio/memory_input_stream/error.rs b/src/gio/memory_input_stream/error.rs index 515d6c9..673906c 100644 --- a/src/gio/memory_input_stream/error.rs +++ b/src/gio/memory_input_stream/error.rs @@ -12,8 +12,8 @@ impl Display for Error { Self::BytesTotal(total, limit) => { write!(f, "Bytes total limit reached: {total} / {limit}") } - Self::InputStream(reason) => { - write!(f, "Input stream error: {reason}") + Self::InputStream(e) => { + write!(f, "Input stream error: {e}") } } }