diff --git a/Cargo.toml b/Cargo.toml index 19e371a..f8bbb55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,3 +25,17 @@ anyhow = "1" bytes = "1" colored = "2" mockall = { version = "0.12", features = ["nightly"] } + +[lints.rust] +warnings = "deny" + +[lints.clippy] +pedantic = { level = "deny", priority = -1 } +nursery = { level = "deny", priority = -1 } +undocumented_unsafe_blocks = "deny" +arithmetic_side_effects = "deny" + +[lints.rustdoc] +all = "warn" +missing_doc_code_examples = "warn" + diff --git a/clippy.toml b/clippy.toml index a450b34..a319ba8 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -doc-valid-idents = ["VersaTest"] \ No newline at end of file +doc-valid-idents = ["VersaTest"] diff --git a/src/interface/async_stream.rs b/src/interface/async_stream.rs index 27cdbfb..407db82 100644 --- a/src/interface/async_stream.rs +++ b/src/interface/async_stream.rs @@ -57,19 +57,19 @@ impl AsyncStream { } fn drop_write_channel(&mut self) -> Result<()> { - match self.write_to.take() { - Some(send) => { - match send.send(AsyncMessage::End) { - Ok(()) => {} - Err(_) => { - return Err(InstrumentError::IoError { source: (std::io::Error::new( + if let Some(send) = self.write_to.take() { + match send.send(AsyncMessage::End) { + Ok(()) => {} + Err(_) => { + return Err(InstrumentError::IoError { + source: (std::io::Error::new( ErrorKind::NotConnected, - "attempted to write asynchronously to socket, but it was not connected".to_string(), - ))}); - } + "attempted to write asynchronously to socket, but it was not connected" + .to_string(), + )), + }); } } - None => {} } Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index fbc6d17..0c06a6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,5 @@ #![feature(lint_reasons, rustdoc_missing_doc_code_examples)] -#![deny( - clippy::undocumented_unsafe_blocks, - clippy::pedantic, - clippy::nursery, - clippy::arithmetic_side_effects -)] #![feature(assert_matches)] -//#![warn(missing_docs, rustdoc::all)] -//#![allow(rustdoc::missing_doc_code_examples)] #![doc(html_logo_url = "../../../ki-comms_doc_icon.png")] //! The TSP Instrument crate defines the necessary components to enable communication @@ -25,7 +17,6 @@ pub mod model; #[cfg(test)] pub(crate) mod test_util; -//pub use connect::{AsyncToSync, Connect, ConnectAsync, ConnectionAddr, Disconnect}; pub use error::InstrumentError; pub use instrument::firmware::Flash; pub use interface::{connection_addr::ConnectionAddr, usbtmc, Interface};