Skip to content

Commit a00fbd6

Browse files
committed
Remove most doctests
1 parent f1781f8 commit a00fbd6

File tree

7 files changed

+2
-145
lines changed

7 files changed

+2
-145
lines changed

crates/data-model/src/tokens.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,6 @@ impl TokenType {
225225
}
226226

227227
/// Generate a token for the given type
228-
///
229-
/// ```rust
230-
/// extern crate rand;
231-
///
232-
/// use rand::thread_rng;
233-
/// use mas_data_model::TokenType::{AccessToken, RefreshToken};
234-
///
235-
/// AccessToken.generate(&mut thread_rng());
236-
/// RefreshToken.generate(&mut thread_rng());
237-
/// ```
238228
pub fn generate(self, rng: &mut (impl RngCore + ?Sized)) -> String {
239229
let random_part: String = rng
240230
.sample_iter(&Alphanumeric)
@@ -250,25 +240,6 @@ impl TokenType {
250240

251241
/// Check the format of a token and determine its type
252242
///
253-
/// ```rust
254-
/// use mas_data_model::TokenType;
255-
///
256-
/// assert_eq!(
257-
/// TokenType::check("mat_kkLSacJDpek22jKWw4AcXG68b7U3W6_0Lg9yb"),
258-
/// Ok(TokenType::AccessToken)
259-
/// );
260-
///
261-
/// assert_eq!(
262-
/// TokenType::check("mar_PkpplxPkfjsqvtdfUlYR1Afg2TpaHF_GaTQd2"),
263-
/// Ok(TokenType::RefreshToken)
264-
/// );
265-
///
266-
/// assert_eq!(
267-
/// TokenType::check("syt_PkpplxPkfjsqvtdfUlYR1Afg2TpaHF_GaTQd2"),
268-
/// Ok(TokenType::CompatAccessToken)
269-
/// );
270-
/// ```
271-
///
272243
/// # Errors
273244
///
274245
/// Returns an error if the token is not valid

crates/handlers/src/passwords.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ impl PasswordManager {
4242
/// complexity score between 0 and 4. The first item in
4343
/// the iterator will be the default hashing scheme.
4444
///
45-
/// # Example
46-
///
47-
/// ```rust
48-
/// pub use mas_handlers::passwords::{PasswordManager, Hasher};
49-
///
50-
/// PasswordManager::new(3, [
51-
/// (3, Hasher::argon2id(Some(b"a-secret-pepper".to_vec()))),
52-
/// (2, Hasher::argon2id(None)),
53-
/// (1, Hasher::bcrypt(Some(10), None)),
54-
/// ]).unwrap();
55-
/// ```
56-
///
5745
/// # Errors
5846
///
5947
/// Returns an error if the iterator was empty

crates/keystore/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -611,24 +611,6 @@ pub struct Keystore {
611611

612612
impl Keystore {
613613
/// Create a keystore out of a JSON Web Key Set
614-
///
615-
/// ```rust
616-
/// use mas_keystore::{Keystore, PrivateKey, JsonWebKey, JsonWebKeySet};
617-
/// let rsa = PrivateKey::load_pem(include_str!("../tests/keys/rsa.pkcs1.pem")).unwrap();
618-
/// let rsa = JsonWebKey::new(rsa);
619-
///
620-
/// let ec_p256 = PrivateKey::load_pem(include_str!("../tests/keys/ec-p256.sec1.pem")).unwrap();
621-
/// let ec_p256 = JsonWebKey::new(ec_p256);
622-
///
623-
/// let ec_p384 = PrivateKey::load_pem(include_str!("../tests/keys/ec-p384.sec1.pem")).unwrap();
624-
/// let ec_p384 = JsonWebKey::new(ec_p384);
625-
///
626-
/// let ec_k256 = PrivateKey::load_pem(include_str!("../tests/keys/ec-k256.sec1.pem")).unwrap();
627-
/// let ec_k256 = JsonWebKey::new(ec_k256);
628-
///
629-
/// let jwks = JsonWebKeySet::new(vec![rsa, ec_p256, ec_p384, ec_k256]);
630-
/// let keystore = Keystore::new(jwks);
631-
/// ```
632614
#[must_use]
633615
pub fn new(keys: JsonWebKeySet<PrivateKey>) -> Self {
634616
let keys = Arc::new(keys);

crates/oauth2-types/src/oidc.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -925,32 +925,6 @@ impl ProviderMetadata {
925925
///
926926
/// To access other fields, use this type's `Deref` implementation.
927927
///
928-
/// # Example
929-
///
930-
/// ```no_run
931-
/// use oauth2_types::{
932-
/// oidc::VerifiedProviderMetadata,
933-
/// requests::GrantType,
934-
/// };
935-
/// use url::Url;
936-
/// # use oauth2_types::oidc::{ProviderMetadata, ProviderMetadataVerificationError};
937-
/// # let metadata = ProviderMetadata::default();
938-
/// # let issuer = "http://localhost/";
939-
/// let verified_metadata = metadata.validate(&issuer)?;
940-
///
941-
/// // The endpoint is required during validation so this is not an `Option`.
942-
/// let _: &Url = verified_metadata.authorization_endpoint();
943-
///
944-
/// // The field has a default value so this is not an `Option`.
945-
/// let _: &[GrantType] = verified_metadata.grant_types_supported();
946-
///
947-
/// // Other fields can be accessed via `Deref`.
948-
/// if let Some(registration_endpoint) = &verified_metadata.registration_endpoint {
949-
/// println!("Registration is supported at {registration_endpoint}");
950-
/// }
951-
/// # Ok::<(), ProviderMetadataVerificationError>(())
952-
/// ```
953-
///
954928
/// [OpenID Connect Discovery Spec 1.0]: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
955929
#[derive(Debug, Clone)]
956930
pub struct VerifiedProviderMetadata {

crates/oauth2-types/src/registration/mod.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -769,33 +769,6 @@ impl ClientMetadata {
769769
///
770770
/// To access other fields, use this type's `Deref` implementation.
771771
///
772-
/// # Example
773-
///
774-
/// ```no_run
775-
/// use oauth2_types::{
776-
/// oidc::ApplicationType,
777-
/// registration::VerifiedClientMetadata,
778-
/// requests::GrantType,
779-
/// };
780-
/// use url::Url;
781-
/// # use oauth2_types::registration::{ClientMetadata, ClientMetadataVerificationError};
782-
/// # let metadata = ClientMetadata::default();
783-
/// # let issuer = Url::parse("http://localhost").unwrap();
784-
/// let verified_metadata = metadata.validate()?;
785-
///
786-
/// // The redirect URIs are required during validation so this is not an `Option`.
787-
/// let _: &[Url] = verified_metadata.redirect_uris();
788-
///
789-
/// // The field has a default value so this is not an `Option`.
790-
/// let _: ApplicationType = verified_metadata.application_type();
791-
///
792-
/// // Other fields can be accessed via `Deref`.
793-
/// if let Some(jwks_uri) = &verified_metadata.jwks_uri {
794-
/// println!("Client's JWK Set is available at {jwks_uri}");
795-
/// }
796-
/// # Ok::<(), ClientMetadataVerificationError>(())
797-
/// ```
798-
///
799772
/// [OpenID Connect Dynamic Client Registration Spec 1.0]: https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata
800773
#[derive(Serialize, Debug, PartialEq, Eq, Clone)]
801774
#[serde(into = "ClientMetadataSerdeHelper")]

crates/storage/src/clock.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ impl Clock for SystemClock {
4848

4949
/// A fake clock, which uses a fixed timestamp, and can be advanced with the
5050
/// [`MockClock::advance`] method.
51-
///
52-
/// ```rust
53-
/// use mas_storage::clock::{Clock, MockClock};
54-
/// use chrono::Duration;
55-
///
56-
/// let clock = MockClock::default();
57-
/// let t1 = clock.now();
58-
/// let t2 = clock.now();
59-
/// assert_eq!(t1, t2);
60-
///
61-
/// clock.advance(Duration::microseconds(10 * 1000 * 1000));
62-
/// let t3 = clock.now();
63-
/// assert_eq!(t2 + Duration::microseconds(10 * 1000 * 1000), t3);
64-
/// ```
6551
pub struct MockClock {
6652
timestamp: AtomicI64,
6753
}

crates/storage/src/lib.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,7 @@
3232
//!
3333
//! The repository trait definition should look like this:
3434
//!
35-
//! ```rust
36-
//! # use async_trait::async_trait;
37-
//! # use ulid::Ulid;
38-
//! # use rand_core::RngCore;
39-
//! # use mas_storage::Clock;
40-
//! #
41-
//! # // A fake data structure, usually defined in mas-data-model
42-
//! # struct FakeData {
43-
//! # id: Ulid,
44-
//! # }
45-
//! #
46-
//! # // A fake empty macro, to replace `mas_storage::repository_impl`
47-
//! # macro_rules! repository_impl { ($($tok:tt)*) => {} }
48-
//!
35+
//! ```ignore
4936
//! #[async_trait]
5037
//! pub trait FakeDataRepository: Send + Sync {
5138
//! /// The error type returned by the repository
@@ -108,11 +95,7 @@
10895
//! Then update the [`RepositoryAccess`] trait to make the new repository
10996
//! available:
11097
//!
111-
//! ```rust
112-
//! # trait FakeDataRepository {
113-
//! # type Error;
114-
//! # }
115-
//!
98+
//! ```ignore
11699
//! /// Access the various repositories the backend implements.
117100
//! pub trait RepositoryAccess: Send {
118101
//! /// The backend-specific error type used by each repository.

0 commit comments

Comments
 (0)