Skip to content

Commit

Permalink
Fix docs and clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudy committed Dec 3, 2023
1 parent 0b35a92 commit 289d503
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/low-level/pebble-schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.build()?;

tracing::info!("Loading private key from {PRIVATE_KEY_PATH:?}");
let key = Arc::new(ecdsa::SigningKey::from(read_private_key(PRIVATE_KEY_PATH)?));
let key = Arc::new((read_private_key(PRIVATE_KEY_PATH)?));

// Step 1: Get an account
tracing::info!("Requesting account");
Expand Down Expand Up @@ -181,7 +181,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let challenge = client
.post::<_, _, _, Challenge>(
challenge.url(),
ChallengeReadyRequest::default(),
ChallengeReadyRequest,
account_key.clone(),
)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion examples/low-level/show-request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.build()?;

tracing::info!("Loading private key from {PRIVATE_KEY_PATH:?}");
let key = Arc::new(ecdsa::SigningKey::from(read_private_key(PRIVATE_KEY_PATH)?));
let key = Arc::new((read_private_key(PRIVATE_KEY_PATH)?));

// Step 1: Get an account
tracing::info!("Requesting account");
Expand Down
2 changes: 1 addition & 1 deletion src/pebble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl Pebble {
&& output
.stdout
.iter()
.map(|&b| (b == '\n' as u8) as u32)
.map(|&b| (b == b'\n') as u32)
.sum::<u32>()
> 2
{
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl ClientBuilder {
///
/// ```no_run
/// # use std::sync::Arc;
/// # use yacme::protocol::Client;
/// # use yacme::protocol::AcmeClient;
/// # use yacme::protocol::Request;
/// # use yacme::protocol::Response;
/// # use signature::rand_core::OsRng;
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Most ACME requests are authenticated as a JWT, signed by the
//! account key. This module provides the implementation of that
//! protocol, and the deserialization of the corresponding responses,
//! as well as providing a [`Client`] type which can be used to
//! as well as providing a [`AcmeClient`] type which can be used to
//! track the correct Nonce through a series of requests.
#![deny(unsafe_code)]
#![deny(missing_docs)]
Expand Down
6 changes: 3 additions & 3 deletions src/protocol/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl<K> From<(Arc<K>, AccountKeyIdentifier)> for Key<K> {
/// ACME prescribes that all requests are POST JWS requests in the flattened
/// JSON format. This structure contains all of the materials *except* the
/// anti-replay [nonce][Nonce] which are required to create an appropriate HTTP
/// request. The [nonce][Nonce] is left out of this object that if the [`super::Client`]
/// request. The [nonce][Nonce] is left out of this object so that if the [`super::AcmeClient`]
/// encounters a bad [nonce][Nonce], it can re-try the same request with a new [nonce][Nonce]
/// value without having to re-build the request object.
///
Expand Down Expand Up @@ -372,8 +372,8 @@ where
/// Sign and finalize this request so that it can be sent over HTTP.
///
/// The resulting [`SignedRequest`] can be converted to a [`reqwest::Request`]
/// for transmission. Normally, this method is not necessary - the [`crate::protocol::Client`]
/// provides [`crate::protocol::Client::execute`] for executing [`Request`] objects natively.
/// for transmission. Normally, this method is not necessary - the [`crate::protocol::AcmeClient`]
/// provides [`crate::protocol::AcmeClient::execute`] for executing [`Request`] objects natively.
pub fn sign(&self, nonce: Nonce) -> Result<SignedRequest, AcmeError> {
let signed_token = self.signed_token(nonce)?;
let mut request = reqwest::Request::new(reqwest::Method::POST, self.url.clone().into());
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<T> Response<T> {

/// Get the [`Nonce`] from this response.
///
/// Normally, this is unnecessay, as [`super::Client`] will automatically handle
/// Normally, this is unnecessay, as [`super::AcmeClient`] will automatically handle
/// and track [`Nonce`] values.
pub fn nonce(&self) -> Option<Nonce> {
super::client::extract_nonce(&self.headers).ok()
Expand Down
2 changes: 1 addition & 1 deletion tests/examples.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn run_example(name: &str) -> std::process::Output {
let output = std::process::Command::new("cargo")
.args(&["run", "--features=pebble", "--example", name])
.args(["run", "--features=pebble", "--example", name])
.output()
.unwrap();

Expand Down
4 changes: 1 addition & 3 deletions tests/pebble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ async fn http01() {
}

fn random_key() -> Arc<ecdsa::SigningKey<p256::NistP256>> {
Arc::new(ecdsa::SigningKey::from(
ecdsa::SigningKey::<p256::NistP256>::random(&mut OsRng),
))
Arc::new(ecdsa::SigningKey::<p256::NistP256>::random(&mut OsRng))
}

#[tracing::instrument("http01")]
Expand Down

0 comments on commit 289d503

Please sign in to comment.