Skip to content

Commit

Permalink
[main] Upgrade to latest Rust version (#6501)
Browse files Browse the repository at this point in the history
This is our monthly toolchain upgrade to the latest stable version. Since iotedge/edgelet is a binary package, we want to be tracking Rust compiler releases closely in the event a stdlib vulnerability is found. We do not pin to "stable", however, since that has caused pipeline breakage when some code patterns are made illegal (like in the upgrade from 1.47 to 1.48 [^0]) or, more often, clippy lints are added.

- Use $crate metavariable in macros referencing crate
- Remove `let () = ..`
- Fix build failure in edgehub-proxy

[^0]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#compatibility-notes-11
  Namely, the point on `mem::uninitialized`.

## Azure IoT Edge PR checklist:
  • Loading branch information
onalante-msft authored Jul 12, 2022
1 parent 98e8736 commit 9a5ebdd
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 35 deletions.
3 changes: 1 addition & 2 deletions edge-modules/edgehub-proxy/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::env;
use std::io::Write;

use edgelet_utils::log_failure;
use env_logger;
use log::{Level, LevelFilter};

Expand Down Expand Up @@ -59,5 +58,5 @@ fn syslog_level(level: Level) -> i8 {
}

pub fn log_error(error: &Error) {
log_failure(Level::Error, error);
log::error!("{}", error);
}
52 changes: 26 additions & 26 deletions edgelet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions edgelet/edgelet-test-utils/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ macro_rules! test_route_err {
};
}

// NOTE: allowing the use of `crate::` since the macro is intended to
// use the type `crate::Service` for the crates it is used in.
#[allow(clippy::crate_in_macro_def)]
#[macro_export]
macro_rules! test_route {
($path:expr) => {{
Expand Down
6 changes: 3 additions & 3 deletions mqtt/mqtt3/examples/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ async fn main() {
.shutdown_handle()
.expect("couldn't get shutdown handle");
tokio::spawn(async move {
let () = tokio::signal::ctrl_c()
tokio::signal::ctrl_c()
.await
.expect("couldn't get Ctrl-C notification");
let result = shutdown_handle.shutdown().await;
let () = result.expect("couldn't send shutdown notification");
result.expect("couldn't send shutdown notification");
});

let payload: bytes::Bytes = payload.into();
Expand Down Expand Up @@ -135,7 +135,7 @@ async fn main() {
payload,
})
.await;
let () = result.expect("couldn't publish");
result.expect("couldn't publish");
log::info!("Published to {}", topic);
Ok::<_, ()>(())
});
Expand Down
4 changes: 2 additions & 2 deletions mqtt/mqtt3/examples/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ async fn main() {
.shutdown_handle()
.expect("couldn't get shutdown handle");
tokio::spawn(async move {
let () = tokio::signal::ctrl_c()
tokio::signal::ctrl_c()
.await
.expect("couldn't get Ctrl-C notification");
let result = shutdown_handle.shutdown().await;
let () = result.expect("couldn't send shutdown notification");
result.expect("couldn't send shutdown notification");
});

let mut update_subscription_handle = client
Expand Down
4 changes: 4 additions & 0 deletions mqtt/mqtt3/src/client/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ where
}
}

// NOTE: clippy is incorrectly marking this as a duplicated trait bound.
// An upstream issue exists documenting this behavior:
// https://github.com/rust-lang/rust-clippy/issues/9076
#[allow(clippy::trait_duplication_in_bounds)]
impl<IoS> Connect<IoS>
where
IoS: super::IoSource,
Expand Down
2 changes: 1 addition & 1 deletion mqtt/mqtt3/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl mqtt3::IoSource for IoSource {
// If the connection broke while there were still steps remaining in the TestConnection, then the dropped sender will cause the test
// to receive a futures_channel::oneshot::Canceled error, so the test will panic before this deadline elapses anyway.
Box::pin(async {
let () = tokio::time::sleep(std::time::Duration::from_secs(5)).await;
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
unreachable!();
})
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.61"
channel = "1.62"

0 comments on commit 9a5ebdd

Please sign in to comment.