Skip to content

Commit

Permalink
[master] Upgrade Rust toolchain (Azure#6126)
Browse files Browse the repository at this point in the history
Unifies toolchain files.

## Azure IoT Edge PR checklist:
  • Loading branch information
onalante-msft authored Feb 14, 2022
1 parent b4a317a commit ab700e8
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 42 deletions.
1 change: 0 additions & 1 deletion edge-hub/watchdog/rust-toolchain

This file was deleted.

4 changes: 2 additions & 2 deletions edge-modules/api-proxy-module/Cargo.lock

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

1 change: 0 additions & 1 deletion edge-modules/api-proxy-module/rust-toolchain

This file was deleted.

4 changes: 2 additions & 2 deletions edgelet/Cargo.lock

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

1 change: 0 additions & 1 deletion edgelet/rust-toolchain

This file was deleted.

4 changes: 2 additions & 2 deletions mqtt/Cargo.lock

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

4 changes: 1 addition & 3 deletions mqtt/mqtt-bridge/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ where
return match self.store.push(&publication) {
Ok(_) => Ok(Handled::Fully),
Err(
err
@
PersistError::RingBuffer(RingBufferError::InsufficientSpace {
err @ PersistError::RingBuffer(RingBufferError::InsufficientSpace {
..
}),
) => {
Expand Down
11 changes: 5 additions & 6 deletions mqtt/mqtt-bridge/src/persist/waking_state/ring_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,12 +981,11 @@ mod tests {

for (key, _) in batch.drain(..) {
let removed = rb.pop().expect("unable to pop publication");
if removed != key {
panic!(
"invalid publication removed {} but expected {}",
removed, key
);
}
assert_eq!(
removed, key,
"invalid publication removed {} but expected {}",
removed, key
);
}

read = rb.metadata.file_pointers.read_begin;
Expand Down
2 changes: 1 addition & 1 deletion mqtt/mqtt-broker/src/state_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a> TryFrom<StateChange<'a>> for proto::Publication {
let payload = subscriptions
.map(|subscriptions| serde_json::to_string(&subscriptions))
.transpose()?
.map(|json| json.into())
.map(Into::into)
.unwrap_or_default();

proto::Publication {
Expand Down
4 changes: 2 additions & 2 deletions mqtt/mqtt-edgehub/src/auth/authentication/edgehub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ impl<'a> EdgeHubAuthRequest<'a> {
version: API_VERSION,
username: context.username(),
password: context.password(),
certificate: context.certificate().map(|cert| cert.as_ref()),
certificate: context.certificate().map(AsRef::as_ref),
certificate_chain: context
.cert_chain()
.map(|chain| chain.iter().map(|cert| cert.as_ref()).collect()),
.map(|chain| chain.iter().map(AsRef::as_ref).collect()),
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions mqtt/mqtt3/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,7 @@ where
client_id,
crate::proto::ClientId::ServerGenerated,
) {
id
@
(crate::proto::ClientId::ServerGenerated
id @ (crate::proto::ClientId::ServerGenerated
| crate::proto::ClientId::IdWithCleanSession(_)) => id,
crate::proto::ClientId::IdWithExistingSession(id) => {
crate::proto::ClientId::IdWithCleanSession(id)
Expand Down
11 changes: 1 addition & 10 deletions mqtt/mqtt3/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,12 @@ where
/// These numbers are encoded with a variable-length scheme that uses the MSB of each byte as a continuation bit.
///
/// Ref: 2.2.3 Remaining Length
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct RemainingLengthDecoder {
result: usize,
num_bytes_read: usize,
}

impl Default for RemainingLengthDecoder {
fn default() -> Self {
RemainingLengthDecoder {
result: 0,
num_bytes_read: 0,
}
}
}

impl tokio_util::codec::Decoder for RemainingLengthDecoder {
type Item = usize;
type Error = DecodeError;
Expand Down
2 changes: 1 addition & 1 deletion mqtt/policy/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl PolicyValidator for DefaultValidator {
let errors = definition
.statements()
.iter()
.flat_map(|statement| visit_statement(statement))
.flat_map(visit_statement)
.collect::<Vec<_>>();

if !errors.is_empty() {
Expand Down
1 change: 0 additions & 1 deletion mqtt/rust-toolchain

This file was deleted.

2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.58"
2 changes: 1 addition & 1 deletion scripts/linux/generic-rust/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function install_rust()
# but it's simpler to just always `update` whatever toolchain it is. `update` installs the toolchain
# if it hasn't already been installed, so this also works for pinned versions.
source $HOME/.cargo/env
rustup update "$(< "$PROJECT_ROOT/rust-toolchain")"
rustup update "$(rustup show active-toolchain | sed 's/ .*//')"
}

###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions test/modules/generic-mqtt-tester/Cargo.lock

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

1 change: 0 additions & 1 deletion test/modules/generic-mqtt-tester/rust-toolchain

This file was deleted.

4 changes: 2 additions & 2 deletions test/modules/obsagent-client/Cargo.lock

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

0 comments on commit ab700e8

Please sign in to comment.