Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
For now allow missing error docs
  • Loading branch information
willemneal committed Apr 30, 2024
1 parent 3cc63b2 commit ca382a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/crates/stellar-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::missing_errors_doc)]
use std::path::PathBuf;

use clap::{arg, command};
Expand Down
10 changes: 8 additions & 2 deletions cmd/crates/stellar-config/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ pub enum Error {
InproperResponse(String),
#[error("Currently not supported on windows. Please visit:\n{0}")]
WindowsNotSupported(String),
#[error("Missing Authority in URL {0}")]
MissingAuthority(String),
#[error("Missing Scheme in URL {0}")]
MissingScheme(String),
}

#[derive(Debug, clap::Args, Clone, Default)]
Expand Down Expand Up @@ -108,8 +112,9 @@ impl Network {
let rpc_uri = Uri::from_str(&self.rpc_url)
.map_err(|_| Error::InvalidUrl(self.rpc_url.to_string()))?;
if self.network_passphrase.as_str() == passphrase::LOCAL {
let auth = rpc_uri.authority().unwrap().clone();
let scheme = rpc_uri.scheme_str().unwrap();
let auth = rpc_uri.authority().ok_or_else(|| Error::MissingAuthority(self.rpc_url.clone()))?.clone();
let scheme = rpc_uri.scheme_str().ok_or_else(|| Error::MissingScheme(self.rpc_url.clone()))?;

Ok(Uri::builder()
.authority(auth)
.scheme(scheme)
Expand Down Expand Up @@ -158,6 +163,7 @@ impl Network {
}

impl Network {
#[must_use]
pub fn futurenet() -> Self {
Network {
rpc_url: "https://rpc-futurenet.stellar.org:443".to_owned(),
Expand Down

0 comments on commit ca382a0

Please sign in to comment.