Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
chore: some clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid committed Jul 20, 2023
1 parent 024f6c0 commit 9912994
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions mint-manager/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ impl Component for App {
fn create(ctx: &Context<Self>) -> Self {
let node_url: Option<Url> = LocalStorage::get::<String>(NODE_URL_KEY)
.ok()
.map(|u| Url::from_str(&u).ok())
.flatten();
.and_then(|u| Url::from_str(&u).ok());

let jwt = LocalStorage::get::<String>(JWT_KEY);

debug!("node: {:?}", node_url);
Expand Down
2 changes: 1 addition & 1 deletion mint-manager/src/components/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Component for Channel {
let jwt = ctx.props().jwt.clone();
let channel_close = requests::CloseChannel {
channel_id: ctx.props().channel_id.clone(),
peer_id: ctx.props().peer_id.clone(),
peer_id: ctx.props().peer_id,
};

let callback = ctx.link().callback(|_| Msg::ChannelClosed);
Expand Down
2 changes: 1 addition & 1 deletion mint/src/ln/cln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ fn from_peer_to_info(peer: &ListpeersPeers) -> Result<responses::PeerInfo, Error
.clone()
.netaddr
.ok_or(Error::Custom("No net address".to_string()))?[0]
.split(":")
.split(':')
.map(|s| s.to_string())
.collect();

Expand Down
8 changes: 1 addition & 7 deletions mint/src/ln/jwt_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ pub async fn auth<B>(
req.headers()
.get("authorization")
.and_then(|auth_header| auth_header.to_str().ok())
.and_then(|auth_value| {
if auth_value.starts_with("Bearer ") {
Some(auth_value[7..].to_owned())
} else {
None
}
})
.and_then(|auth_value| auth_value.strip_prefix("Bearer ").map(|s| s.to_owned()))
});
debug!(" token {:?}", token);
let token = token.ok_or_else(|| {
Expand Down
6 changes: 3 additions & 3 deletions mint/src/ln/lnurl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct AuthTokenResponse {
}

impl LnUrl {
pub fn new_auth_lnurl(url: Url, tag: Action, action: Action) -> Self {
pub fn _new_auth_lnurl(url: Url, tag: Action, action: Action) -> Self {
let mut rng = rand::thread_rng();
let random_bytes: [u8; 32] = rng.gen();

Expand All @@ -74,7 +74,7 @@ impl LnUrl {
bech32::encode("lnurl", base32, Variant::Bech32).unwrap()
}

pub fn decode(lnurl: String) -> Result<LnUrl, Error> {
pub fn _decode(lnurl: String) -> Result<LnUrl, Error> {
LnUrl::from_str(&lnurl)
}
}
Expand Down Expand Up @@ -125,7 +125,7 @@ mod tests {
#[test]
fn new_lnurl_test() {
let service = url::Url::from_str("https://service.com").unwrap();
let lnurl = LnUrl::new_auth_lnurl(service, Action::Login, Action::Login);
let lnurl = LnUrl::_new_auth_lnurl(service, Action::Login, Action::Login);

println!("{}", lnurl.encode());

Expand Down
6 changes: 3 additions & 3 deletions mint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async fn main() -> anyhow::Result<()> {
};

Ln {
ln_processor: cln.clone(),
ln_processor: cln,
node_manager,
}
}
Expand All @@ -138,7 +138,7 @@ async fn main() -> anyhow::Result<()> {
};

Ln {
ln_processor: gln.clone(),
ln_processor: gln,
node_manager,
}
}
Expand All @@ -151,7 +151,7 @@ async fn main() -> anyhow::Result<()> {
};

Ln {
ln_processor: ldk.clone(),
ln_processor: ldk,
node_manager,
}
}
Expand Down

0 comments on commit 9912994

Please sign in to comment.