Repository: lemunozm/message-io (language: rust)

Issue:
Packages contain code that will be rejected by a future version of Rust
Hello,
after adding message-io to new project and compiling, i got the following message:

--------------------------------------------------------------------------------------------------------------------
warning: the following packages contain code that will be rejected by a future version of Rust: ntapi v0.3.7
note:
To solve this problem, you can try the following approaches:


- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

ntapi v0.3.7 has the following newer versions available: 0.4.0


- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - ntapi@0.3.7
  - Repository: https://github.com/MSxDOS/ntapi
  - Detailed warning command: `cargo report future-incompatibilities --id 4 --package ntapi@0.3.7`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

note: this report can be shown with `cargo report future-incompatibilities --id 4`

--------------------------------------------------------------------------------------------------------------------

It seems that just updating the dependency would fix this issue, in case it does not i would make a issue in their repo :)


Discussion / hints:
Hi! I'm not able to check the error because I'm not in windows, and `ntapi` is only compiled there. I do not use this dependency directly in `message-io`, so it seems that there is any other dependency that includes that. I've updated all dependencies in this branch: `dependencies-updated`. 

Could you please check if importing the updated version into your project still generates the issue?
To address to this specific change in Cargo.toml:
```toml
message-io = { git = "https://github.com/lemunozm/message-io", branch = "dependencies-updated" }
``` 
Thanks!!
Unfortunately that didnt fix it :(
I cant seem to track down the dependency in message-io that causes this, because of the limited output i am getting from cargo.
Perhaps we could use a [patch] like in message-io to get rid of this like cargo suggested? That would (rather forcefully) get rid of the outdated dependency.


If thats a valid option i'd make a PR :)
To be honest I've never dealt with this problem, but if that patch works, I'm fine with the PR 😃 
After trying to fix this [i just noticed that i cannot [patch] the version of a dependency's dependency](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section) :(
The only way to fix this is to actually track down what dependency includes ntapi and then file a PR/Issue there
I will try to track down the dependency if i have some free time, but at the moment i have lots of work to do so no idea when i will get around to doing it - I'll keep you updated
Thanks for the info 😃. One question, a `cargo tree` in Windows does not show the `ntapi` dependency somewhere?
You can use `cargo tree --target x86_64-pc-windows-gnu` on linux, the dep is coming from mio 
![image](https://user-images.githubusercontent.com/22427111/195992730-f8c00740-a64f-45f8-b55b-5bc6fd9f7fd2.png)

Mio already have replaced those deps with windows-sys in latest version https://github.com/tokio-rs/mio/pull/1556
Thanks, @sigmaSd, for the advice!
Seems like it's time to update `mio` to version 0.8. I'll try to get some time to do it.
Hi @lemunozm,

I just wanted to ask when you could release a message-io version with the updated dependency :-)

All that's really needed is changing the Cargo.toml to use mio 0.8, which  I did locally. All message-io tests run fine, so does my application.

Thanks!



Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3aa6f3..1a73e1e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## Release 0.14.7
+- Updated mio to 0.8
+- Updated cargo clippy
+
 ## Release 0.14.6
 - Updated dependencies.
 - Fixed clippy issues in nightly.
diff --git a/Cargo.lock b/Cargo.lock
index 765a1ca..d02143c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -426,7 +426,7 @@ dependencies = [
 
 [[package]]
 name = "message-io"
-version = "0.14.6"
+version = "0.14.7"
 dependencies = [
  "bincode",
  "chrono",
@@ -451,33 +451,14 @@ dependencies = [
 
 [[package]]
 name = "mio"
-version = "0.7.14"
+version = "0.8.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
+checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
 dependencies = [
  "libc",
  "log",
- "miow",
- "ntapi",
- "winapi",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "ntapi"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
-dependencies = [
- "winapi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
+ "windows-sys",
 ]
 
 [[package]]
@@ -1071,3 +1052,69 @@ name = "winapi-x86_64-pc-windows-gnu"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.45.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
diff --git a/Cargo.toml b/Cargo.toml
index 8fde2d0..b745601 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "message-io"
-version = "0.14.6"
+version = "0.14.7"
 authors = ["lemunozm <lemunozm@gmail.com>"]
 edition = "2018"
 readme = "README.md"
@@ -19,12 +19,12 @@ all-features = true
 
 [features]
 default = ["tcp", "udp", "websocket"] # All features by default
-tcp = ["mio/tcp"]
-udp = ["mio/udp", "socket2"]
+tcp = ["mio/net"]
+udp = ["mio/net", "socket2"]
 websocket = ["tungstenite", "url", "tcp"]
 
 [dependencies]
-mio = { version = "0.7", features = ["os-poll"] }
+mio = { version = "0.8", features = ["os-poll"] }
 serde = { version = "1.0", features = ["derive"] }
 crossbeam-channel = "0.5"
 crossbeam-utils = "0.8"
diff --git a/src/adapters/ws.rs b/src/adapters/ws.rs
index 18b3d04..690ee02 100644
--- a/src/adapters/ws.rs
+++ b/src/adapters/ws.rs
@@ -42,6 +42,7 @@ enum PendingHandshake {
     Server(MidHandshake<ServerHandshake<ArcTcpStream, NoCallback>>),
 }
 
+#[allow(clippy::large_enum_variant)]
 enum RemoteState {
     WebSocket(WebSocket<ArcTcpStream>),
     Handshake(Option<PendingHandshake>),
@@ -78,7 +79,7 @@ impl Remote for RemoteResource {
     fn connect(remote_addr: RemoteAddr) -> io::Result<ConnectionInfo<Self>> {
         let (peer_addr, url) = match remote_addr {
             RemoteAddr::Socket(addr) => {
-                (addr, Url::parse(&format!("ws://{}/message-io-default", addr)).unwrap())
+                (addr, Url::parse(&format!("ws://{addr}/message-io-default")).unwrap())
             }
             RemoteAddr::Str(path) => {
                 let url = Url::parse(&path).expect("A valid URL");
diff --git a/src/network/driver.rs b/src/network/driver.rs
index 4362108..cc9aabb 100644
--- a/src/network/driver.rs
+++ b/src/network/driver.rs
@@ -58,12 +58,12 @@ pub enum NetEvent<'a> {
 impl std::fmt::Debug for NetEvent<'_> {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         let string = match self {
-            Self::Connected(endpoint, status) => format!("Connected({}, {})", endpoint, status),
-            Self::Accepted(endpoint, id) => format!("Accepted({}, {})", endpoint, id),
+            Self::Connected(endpoint, status) => format!("Connected({endpoint}, {status})"),
+            Self::Accepted(endpoint, id) => format!("Accepted({endpoint}, {id})"),
             Self::Message(endpoint, data) => format!("Message({}, {})", endpoint, data.len()),
-            Self::Disconnected(endpoint) => format!("Disconnected({})", endpoint),
+            Self::Disconnected(endpoint) => format!("Disconnected({endpoint})"),
         };
-        write!(f, "NetEvent::{}", string)
+        write!(f, "NetEvent::{string}")
     }
 }
 
@@ -313,9 +313,9 @@ impl<R: Remote, L: Local<Remote = R>> Driver<R, L> {
 impl<R> std::fmt::Display for AcceptedType<'_, R> {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         let string = match self {
-            AcceptedType::Remote(addr, _) => format!("Remote({})", addr),
-            AcceptedType::Data(addr, _) => format!("Data({})", addr),
+            AcceptedType::Remote(addr, _) => format!("Remote({addr})"),
+            AcceptedType::Data(addr, _) => format!("Data({addr})"),
         };
-        write!(f, "AcceptedType::{}", string)
+        write!(f, "AcceptedType::{string}")
     }
 }
diff --git a/src/network/remote_addr.rs b/src/network/remote_addr.rs
index e3e7c22..174cc89 100644
--- a/src/network/remote_addr.rs
+++ b/src/network/remote_addr.rs
@@ -61,8 +61,8 @@ impl ToSocketAddrs for RemoteAddr {
 impl std::fmt::Display for RemoteAddr {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
-            RemoteAddr::Socket(addr) => write!(f, "{}", addr),
-            RemoteAddr::Str(string) => write!(f, "{}", string),
+            RemoteAddr::Socket(addr) => write!(f, "{addr}"),
+            RemoteAddr::Str(string) => write!(f, "{string}"),
         }
     }
 }
diff --git a/src/network/resource_id.rs b/src/network/resource_id.rs
index 56500ce..5ad45fd 100644
--- a/src/network/resource_id.rs
+++ b/src/network/resource_id.rs
@@ -112,7 +112,7 @@ impl std::fmt::Display for ResourceId {
 
 impl std::fmt::Debug for ResourceId {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "{}", self)
+        write!(f, "{self}")
     }
 }
 
diff --git a/src/network/transport.rs b/src/network/transport.rs
index 5b84561..75e3864 100644
--- a/src/network/transport.rs
+++ b/src/network/transport.rs
@@ -153,6 +153,6 @@ impl From<u8> for Transport {
 
 impl std::fmt::Display for Transport {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "{:?}", self)
+        write!(f, "{self:?}")
     }
 }
diff --git a/src/node.rs b/src/node.rs
index 41f6874..032b031 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -30,8 +30,8 @@ pub enum NodeEvent<'a, S> {
 impl<'a, S: std::fmt::Debug> std::fmt::Debug for NodeEvent<'a, S> {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
-            NodeEvent::Network(net_event) => write!(f, "NodeEvent::Network({:?})", net_event),
-            NodeEvent::Signal(signal) => write!(f, "NodeEvent::Signal({:?})", signal),
+            NodeEvent::Network(net_event) => write!(f, "NodeEvent::Network({net_event:?})"),
+            NodeEvent::Signal(signal) => write!(f, "NodeEvent::Signal({signal:?})"),
         }
     }
 }
@@ -73,8 +73,8 @@ pub enum StoredNodeEvent<S> {
 impl<S: std::fmt::Debug> std::fmt::Debug for StoredNodeEvent<S> {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
-            StoredNodeEvent::Network(net_event) => write!(f, "NodeEvent::Network({:?})", net_event),
-            StoredNodeEvent::Signal(signal) => write!(f, "NodeEvent::Signal({:?})", signal),
+            StoredNodeEvent::Network(net_event) => write!(f, "NodeEvent::Network({net_event:?})"),
+            StoredNodeEvent::Signal(signal) => write!(f, "NodeEvent::Signal({signal:?})"),
         }
     }
 }


Test patch: