Use full path imports for dependencies to reduce cfg hell

This commit is contained in:
Philipp Hoenisch 2020-10-28 11:18:14 +11:00
parent a1351e5461
commit b8fd9a734f
No known key found for this signature in database
GPG Key ID: E5F8E74C672BC666
2 changed files with 8 additions and 10 deletions

View File

@ -40,10 +40,10 @@ jobs:
- name: Check code formatting - name: Check code formatting
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
- name: Run clippy - name: Run clippy with default features
run: cargo clippy --workspace --all-targets -- -D warnings run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run clippy all features - name: Run clippy with all features enabled (e.g. tor)
run: cargo clippy --workspace --all-targets --all-features -- -D warnings run: cargo clippy --workspace --all-targets --all-features -- -D warnings
build_test: build_test:

View File

@ -36,10 +36,6 @@ pub const PORT: u16 = 9876; // Arbitrarily chosen.
pub const ADDR: &str = "127.0.0.1"; pub const ADDR: &str = "127.0.0.1";
pub const BITCOIND_JSON_RPC_URL: &str = "http://127.0.0.1:8332"; pub const BITCOIND_JSON_RPC_URL: &str = "http://127.0.0.1:8332";
#[cfg(feature = "tor")]
use swap::tor::{AuthenticatedConnection, UnauthenticatedConnection};
#[cfg(feature = "tor")]
use torut::onion::TorSecretKeyV3;
#[cfg(feature = "tor")] #[cfg(feature = "tor")]
pub const TOR_PORT: u16 = PORT + 1; pub const TOR_PORT: u16 = PORT + 1;
@ -51,7 +47,7 @@ async fn main() -> Result<()> {
#[cfg(feature = "tor")] #[cfg(feature = "tor")]
let (addr, _ac) = { let (addr, _ac) = {
let tor_secret_key = TorSecretKeyV3::generate(); let tor_secret_key = torut::onion::TorSecretKeyV3::generate();
let onion_address = tor_secret_key let onion_address = tor_secret_key
.public() .public()
.get_onion_address() .get_onion_address()
@ -121,9 +117,11 @@ async fn main() -> Result<()> {
} }
#[cfg(feature = "tor")] #[cfg(feature = "tor")]
async fn create_tor_service(tor_secret_key: TorSecretKeyV3) -> Result<AuthenticatedConnection> { async fn create_tor_service(
// todo use configurable ports for tor connection tor_secret_key: torut::onion::TorSecretKeyV3,
let mut authenticated_connection = UnauthenticatedConnection::default() ) -> Result<swap::tor::AuthenticatedConnection> {
// TODO use configurable ports for tor connection
let mut authenticated_connection = swap::tor::UnauthenticatedConnection::default()
.init_authenticated_connection() .init_authenticated_connection()
.await?; .await?;
tracing::info!("Tor authenticated."); tracing::info!("Tor authenticated.");