Skip to content

Commit

Permalink
refactor(pubky): remove publickey from endpoint struct for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuhvi committed Sep 13, 2024
1 parent f381f9f commit f999475
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pubky/src/shared/pkarr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl PubkyClient {
return Err(Error::ResolveEndpoint(original_target.into()));
}

if let Some(public_key) = endpoint_public_key {
if endpoint_public_key.is_some() {
let url = Url::parse(&format!(
"{}://{}",
if origin.starts_with("localhost") {
Expand All @@ -152,7 +152,7 @@ impl PubkyClient {
origin
))?;

return Ok(Endpoint { public_key, url });
return Ok(Endpoint { url });
}

Err(Error::ResolveEndpoint(original_target.into()))
Expand All @@ -173,8 +173,6 @@ impl PubkyClient {

#[derive(Debug)]
pub(crate) struct Endpoint {
// TODO: we don't use this at all?
pub public_key: PublicKey,
pub url: Url,
}

Expand Down Expand Up @@ -326,12 +324,11 @@ mod tests {
.await
.unwrap();

let Endpoint { public_key, url } = client
let Endpoint { url, .. } = client
.resolve_pubky_homeserver(&pubky.public_key())
.await
.unwrap();

assert_eq!(public_key, server.public_key());
assert_eq!(url.host_str(), Some("localhost"));
assert_eq!(url.port(), Some(server.port()));
}
Expand Down

0 comments on commit f999475

Please sign in to comment.