Skip to content

Commit

Permalink
Use rust toolchain nightly-2020-06-10 and [email protected]
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
sdbondi committed Jun 11, 2020
1 parent c856c51 commit d0d930c
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clippy-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion comms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down
14 changes: 10 additions & 4 deletions comms/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions comms/src/test_utils/factories/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
};

}
14 changes: 8 additions & 6 deletions comms/src/tor/hidden_service/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Multiaddr>);

/// 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<TorIdentity>);

/// 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
Expand Down
10 changes: 5 additions & 5 deletions comms/src/transports/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>);

/// 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<usize>);

/// 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<u32>);

/// 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<Option<Duration>>);

/// 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<bool>);

/// Create a new TcpTransport
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2020-01-08
nightly-2020-06-10

0 comments on commit d0d930c

Please sign in to comment.