From d0d930c14efc5b93ef94cca89235589ebd9b87ab Mon Sep 17 00:00:00 2001 From: Stanimal Date: Thu, 11 Jun 2020 10:29:39 +0200 Subject: [PATCH] Use rust toolchain nightly-2020-06-10 and clear_on_drop@0.2.4 - Circle CI and `rust-toolchain` updated to use `nightly-2020-06-10` - `clear_on_drop` set to version 0.2.4 - `setter_mut!` macro captures doc attrs to prevent `unused_doc_comments` warnings - Updated github actions config This is required because of a rust breaking change (new `asm!` syntax, old syntax renamed to `llvm_asm!` under feature flag) --- .circleci/config.yml | 2 +- .github/workflows/clippy-check.yml | 2 +- comms/Cargo.toml | 2 +- comms/src/macros.rs | 14 ++++++++++---- comms/src/test_utils/factories/macros.rs | 5 ++--- comms/src/tor/hidden_service/builder.rs | 14 ++++++++------ comms/src/transports/tcp.rs | 10 +++++----- rust-toolchain | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index abaf3d723b..6ec1af0afe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 defaults: - rust_image: &rust_image quay.io/tarilabs/rust_tari-build-with-deps:nightly-2020-01-08 + rust_image: &rust_image quay.io/tarilabs/rust_tari-build-with-deps:nightly-2020-06-10 commands: test: diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml index bbb4de07ca..6432f5ddac 100644 --- a/.github/workflows/clippy-check.yml +++ b/.github/workflows/clippy-check.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2020-01-08 + toolchain: nightly-2020-06-10 components: clippy, rustfmt override: true - name: Install dependencies diff --git a/comms/Cargo.toml b/comms/Cargo.toml index cc390b2e9e..5263111a9b 100644 --- a/comms/Cargo.toml +++ b/comms/Cargo.toml @@ -19,7 +19,7 @@ blake2 = "0.8.1" bytes = { version = "0.5.x", features=["serde"] } chrono = { version = "0.4.6", features = ["serde"] } cidr = "0.1.0" -clear_on_drop = "=0.2.3" +clear_on_drop = "=0.2.4" data-encoding = "2.2.0" digest = "0.8.0" futures = { version = "^0.3", features = ["async-await"]} diff --git a/comms/src/macros.rs b/comms/src/macros.rs index 919b4b2969..4fdddee169 100644 --- a/comms/src/macros.rs +++ b/comms/src/macros.rs @@ -23,15 +23,21 @@ /// Creates a setter function used with the builder pattern. /// The value is moved into the function and returned out. macro_rules! setter { - ($func:ident, $name: ident, Option<$type: ty>) => { - #[allow(unused_doc_comments)] + ( + $(#[$outer:meta])* + $func:ident, $name: ident, Option<$type: ty> + ) => { + $(#[$outer])* pub fn $func(mut self, val: $type) -> Self { self.$name = Some(val); self } }; - ($func:ident, $name: ident, $type: ty) => { - #[allow(unused_doc_comments)] + ( + $(#[$outer:meta])* + $func:ident, $name: ident, $type: ty + ) => { + $(#[$outer])* pub fn $func(mut self, val: $type) -> Self { self.$name = val; self diff --git a/comms/src/test_utils/factories/macros.rs b/comms/src/test_utils/factories/macros.rs index fcca035a6a..fcc64c7af9 100644 --- a/comms/src/test_utils/factories/macros.rs +++ b/comms/src/test_utils/factories/macros.rs @@ -21,19 +21,18 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. macro_rules! factory_setter { - ($func:ident, $name: ident, Option<$type: ty>) => { + ($func:ident, $name: ident, Option<$type: ty>) => { #[allow(dead_code)] pub fn $func(mut self, val: $type) -> Self { self.$name = Some(val); self } }; - ($func:ident, $name: ident, $type: ty) => { + ($func:ident, $name: ident, $type: ty) => { #[allow(dead_code)] pub fn $func(mut self, val: $type) -> Self { self.$name = val; self } }; - } diff --git a/comms/src/tor/hidden_service/builder.rs b/comms/src/tor/hidden_service/builder.rs index 7e56bd3cb9..7cdad78564 100644 --- a/comms/src/tor/hidden_service/builder.rs +++ b/comms/src/tor/hidden_service/builder.rs @@ -77,20 +77,22 @@ impl HiddenServiceBuilder { } impl HiddenServiceBuilder { - /// The address of the Tor Control Port. An error will result if this is not provided. + #[doc("The address of the Tor Control Port. An error will result if this is not provided.")] setter!(with_control_server_address, control_server_addr, Option); - /// Authentication settings for the Tor Control Port. + #[doc("Authentication settings for the Tor Control Port.")] setter!(with_control_server_auth, control_server_auth, Authentication); - /// Authentication to use for the SOCKS5 proxy. + #[doc("Authentication to use for the SOCKS5 proxy.")] setter!(with_socks_authentication, socks_auth, socks::Authentication); - /// The identity of the hidden service. When set, this key is used to enable routing from the Tor network to - /// this address. If this is not set, a new service will be requested from the Tor Control Port. + #[doc( + "The identity of the hidden service. When set, this key is used to enable routing from the Tor network to \ + this address. If this is not set, a new service will be requested from the Tor Control Port." + )] setter!(with_tor_identity, identity, Option); - /// Configuration flags for the hidden service + #[doc("Configuration flags for the hidden service")] setter!(with_hs_flags, hs_flags, HsFlags); /// The address of the SOCKS5 server. If an address is None, the hidden service builder will use the SOCKS diff --git a/comms/src/transports/tcp.rs b/comms/src/transports/tcp.rs index 7d8ddd8242..bbc1907973 100644 --- a/comms/src/transports/tcp.rs +++ b/comms/src/transports/tcp.rs @@ -47,19 +47,19 @@ pub struct TcpTransport { } impl TcpTransport { - /// Sets `SO_RCVBUF` i.e the size of the receive buffer. + #[doc("Sets `SO_RCVBUF` i.e the size of the receive buffer.")] setter_mut!(set_recv_buffer_size, recv_buffer_size, Option); - /// Sets `SO_SNDBUF` i.e. the size of the send buffer. + #[doc("Sets `SO_SNDBUF` i.e. the size of the send buffer.")] setter_mut!(set_send_buffer_size, send_buffer_size, Option); - /// Sets `IP_TTL` i.e. the TTL of packets sent from this socket. + #[doc("Sets `IP_TTL` i.e. the TTL of packets sent from this socket.")] setter_mut!(set_ttl, ttl, Option); - /// Sets `SO_KEEPALIVE` i.e. the interval to send keepalive probes, or None to disable. + #[doc("Sets `SO_KEEPALIVE` i.e. the interval to send keepalive probes, or None to disable.")] setter_mut!(set_keepalive, keepalive, Option>); - /// Sets `TCP_NODELAY` i.e enable/disable Nagle's algorithm. + #[doc("Sets `TCP_NODELAY` i.e disable Nagle's algorithm if set to true.")] setter_mut!(set_nodelay, nodelay, Option); /// Create a new TcpTransport diff --git a/rust-toolchain b/rust-toolchain index ee412581d8..4aec5c6b40 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-01-08 +nightly-2020-06-10