From 3edc302f5afeac71258e04abed7cfed17c8a1e83 Mon Sep 17 00:00:00 2001 From: Luca Cominardi Date: Mon, 18 Mar 2024 11:27:11 +0100 Subject: [PATCH] Address comments --- Cargo.lock | 120 +-------------------------- commons/zenoh-codec/src/core/zint.rs | 10 +-- 2 files changed, 7 insertions(+), 123 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba84d51ee8..81242dc859 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1091,15 +1091,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "env_filter" version = "0.1.0" @@ -1463,25 +1454,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "h2" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.9", - "indexmap 1.9.3", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "half" version = "1.8.2" @@ -1567,17 +1539,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.0.0" @@ -1589,17 +1550,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http 0.2.9", - "pin-project-lite 0.2.13", -] - [[package]] name = "http-client" version = "6.5.3" @@ -1646,30 +1596,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.9", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite 0.2.13", - "socket2 0.4.9", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "iana-time-zone" version = "0.1.57" @@ -2752,40 +2678,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" -[[package]] -name = "reqwest" -version = "0.11.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" -dependencies = [ - "base64 0.21.4", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http 0.2.9", - "http-body", - "hyper", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite 0.2.13", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "ring" version = "0.16.20" @@ -3816,15 +3708,8 @@ dependencies = [ "hashbrown 0.14.0", "pin-project-lite 0.2.13", "tokio", - "tracing", ] -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - [[package]] name = "tracing" version = "0.1.37" @@ -3867,7 +3752,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.0.0", + "http", "httparse", "log", "rand 0.8.5", @@ -4631,6 +4516,7 @@ dependencies = [ "zenoh-core", "zenoh-macros", "zenoh-result", + "zenoh-runtime", "zenoh-sync", "zenoh-util", ] @@ -4679,13 +4565,11 @@ dependencies = [ "flume", "futures", "log", - "lz4_flex", "rustls 0.22.2", "rustls-webpki 0.102.2", "serde", "tokio", "tokio-util", - "typenum", "zenoh-buffers", "zenoh-codec", "zenoh-core", diff --git a/commons/zenoh-codec/src/core/zint.rs b/commons/zenoh-codec/src/core/zint.rs index eefea64b38..d5e1c158ec 100644 --- a/commons/zenoh-codec/src/core/zint.rs +++ b/commons/zenoh-codec/src/core/zint.rs @@ -112,13 +112,13 @@ where fn write(self, writer: &mut W, mut x: u64) -> Self::Output { writer.with_slot(VLE_LEN, move |buffer| { let mut len = 0; - while (x & !0x7f) != 0 { + while (x & !0x7f_u64) != 0 { // SAFETY: buffer is guaranteed to be VLE_LEN long where VLE_LEN is // the maximum number of bytes a VLE can take once encoded. // I.e.: x is shifted 7 bits to the right every iteration, // the loop is at most VLE_LEN iterations. unsafe { - *buffer.get_unchecked_mut(len) = (x as u8) | 0x80; + *buffer.get_unchecked_mut(len) = (x as u8) | 0x80_u8; } len += 1; x >>= 7; @@ -144,15 +144,15 @@ where fn read(self, reader: &mut R) -> Result { let mut b = reader.read_u8()?; - if (b & 0x80) == 0 { + if (b & 0x80_u8) == 0 { return Ok(b as u64); } let mut v = 0; let mut i = 0; // 7 * VLE_LEN is beyond the maximum number of shift bits - while (b & 0x80) != 0 && i != 7 * VLE_LEN { - v |= ((b & 0x7f) as u64) << i; + while (b & 0x80_u8) != 0 && i != 7 * VLE_LEN { + v |= ((b & 0x7f_u8) as u64) << i; b = reader.read_u8()?; i += 7; }