Skip to content

Commit 38654e9

Browse files
authored
Warn on missing doc (#199)
We want to encourage documentation on all public items. I'm not completely sold on the idea since certain things are self-descriptive but we also should strongly discourage undocumented things. Adds `missing_docs = "warn"` to cargo workspace and adds `allow(missing_docs)` to all existing violations. The plan is to prevent new infractions and to slowly document as we work on areas.
1 parent d919643 commit 38654e9

File tree

133 files changed

+433
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+433
-8
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ pkcs5 = { git = "https://github.com/bitwarden/rustcrypto-formats.git", rev = "2b
8282
unused_async = "deny"
8383
unwrap_used = "deny"
8484

85+
[workspace.lints.rust]
86+
missing_docs = "warn"
87+
8588
# Compile all dependencies with some optimizations when building this crate on debug
8689
# This slows down clean builds by about 50%, but the resulting binaries can be orders of magnitude faster
8790
# As clean builds won't occur very often, this won't slow down the development process
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# bitwarden-sm

bitwarden_license/bitwarden-sm/src/client_projects.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,50 @@ use crate::{
1212
/// Aliases to maintain backward compatibility
1313
pub type ClientProjects = ProjectsClient;
1414

15+
#[allow(missing_docs)]
1516
pub struct ProjectsClient {
1617
pub client: Client,
1718
}
1819

1920
impl ProjectsClient {
21+
#[allow(missing_docs)]
2022
pub fn new(client: Client) -> Self {
2123
Self { client }
2224
}
2325

26+
#[allow(missing_docs)]
2427
pub async fn get(
2528
&self,
2629
input: &ProjectGetRequest,
2730
) -> Result<ProjectResponse, SecretsManagerError> {
2831
get_project(&self.client, input).await
2932
}
3033

34+
#[allow(missing_docs)]
3135
pub async fn create(
3236
&self,
3337
input: &ProjectCreateRequest,
3438
) -> Result<ProjectResponse, SecretsManagerError> {
3539
create_project(&self.client, input).await
3640
}
3741

42+
#[allow(missing_docs)]
3843
pub async fn list(
3944
&self,
4045
input: &ProjectsListRequest,
4146
) -> Result<ProjectsResponse, SecretsManagerError> {
4247
list_projects(&self.client, input).await
4348
}
4449

50+
#[allow(missing_docs)]
4551
pub async fn update(
4652
&self,
4753
input: &ProjectPutRequest,
4854
) -> Result<ProjectResponse, SecretsManagerError> {
4955
update_project(&self.client, input).await
5056
}
5157

58+
#[allow(missing_docs)]
5259
pub async fn delete(
5360
&self,
5461
input: ProjectsDeleteRequest,
@@ -59,6 +66,7 @@ impl ProjectsClient {
5966

6067
/// This trait is for backward compatibility
6168
pub trait ClientProjectsExt {
69+
#[allow(missing_docs)]
6270
fn projects(&self) -> ClientProjects;
6371
}
6472

@@ -68,7 +76,9 @@ impl ClientProjectsExt for Client {
6876
}
6977
}
7078

79+
#[allow(missing_docs)]
7180
pub trait ProjectsClientExt {
81+
#[allow(missing_docs)]
7282
fn projects(&self) -> ProjectsClient;
7383
}
7484

bitwarden_license/bitwarden-sm/src/client_secrets.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,64 +15,74 @@ use crate::{
1515
/// Aliases to maintain backward compatibility
1616
pub type ClientSecrets = SecretsClient;
1717

18+
#[allow(missing_docs)]
1819
pub struct SecretsClient {
1920
client: Client,
2021
}
2122

2223
impl SecretsClient {
24+
#[allow(missing_docs)]
2325
pub fn new(client: Client) -> Self {
2426
Self { client }
2527
}
2628

29+
#[allow(missing_docs)]
2730
pub async fn get(
2831
&self,
2932
input: &SecretGetRequest,
3033
) -> Result<SecretResponse, SecretsManagerError> {
3134
get_secret(&self.client, input).await
3235
}
3336

37+
#[allow(missing_docs)]
3438
pub async fn get_by_ids(
3539
&self,
3640
input: SecretsGetRequest,
3741
) -> Result<SecretsResponse, SecretsManagerError> {
3842
get_secrets_by_ids(&self.client, input).await
3943
}
4044

45+
#[allow(missing_docs)]
4146
pub async fn create(
4247
&self,
4348
input: &SecretCreateRequest,
4449
) -> Result<SecretResponse, SecretsManagerError> {
4550
create_secret(&self.client, input).await
4651
}
4752

53+
#[allow(missing_docs)]
4854
pub async fn list(
4955
&self,
5056
input: &SecretIdentifiersRequest,
5157
) -> Result<SecretIdentifiersResponse, SecretsManagerError> {
5258
list_secrets(&self.client, input).await
5359
}
5460

61+
#[allow(missing_docs)]
5562
pub async fn list_by_project(
5663
&self,
5764
input: &SecretIdentifiersByProjectRequest,
5865
) -> Result<SecretIdentifiersResponse, SecretsManagerError> {
5966
list_secrets_by_project(&self.client, input).await
6067
}
6168

69+
#[allow(missing_docs)]
6270
pub async fn update(
6371
&self,
6472
input: &SecretPutRequest,
6573
) -> Result<SecretResponse, SecretsManagerError> {
6674
update_secret(&self.client, input).await
6775
}
6876

77+
#[allow(missing_docs)]
6978
pub async fn delete(
7079
&self,
7180
input: SecretsDeleteRequest,
7281
) -> Result<SecretsDeleteResponse, SecretsManagerError> {
7382
delete_secrets(&self.client, input).await
7483
}
7584

85+
#[allow(missing_docs)]
7686
pub async fn sync(
7787
&self,
7888
input: &SecretsSyncRequest,
@@ -83,6 +93,7 @@ impl SecretsClient {
8393

8494
/// This trait is for backward compatibility
8595
pub trait ClientSecretsExt {
96+
#[allow(missing_docs)]
8697
fn secrets(&self) -> ClientSecrets;
8798
}
8899

@@ -92,7 +103,9 @@ impl ClientSecretsExt for Client {
92103
}
93104
}
94105

106+
#[allow(missing_docs)]
95107
pub trait SecretsClientExt {
108+
#[allow(missing_docs)]
96109
fn secrets(&self) -> SecretsClient;
97110
}
98111

bitwarden_license/bitwarden-sm/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
#![doc = include_str!("../README.md")]
2+
13
mod client_projects;
24
mod client_secrets;
35
mod error;
6+
#[allow(missing_docs)]
47
pub mod projects;
8+
#[allow(missing_docs)]
59
pub mod secrets;
610

711
pub use client_projects::{ClientProjects, ClientProjectsExt, ProjectsClient, ProjectsClientExt};

bitwarden_license/bitwarden-sm/src/projects/create.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
projects::ProjectResponse,
1212
};
1313

14+
#[allow(missing_docs)]
1415
#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)]
1516
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1617
pub struct ProjectCreateRequest {

bitwarden_license/bitwarden-sm/src/projects/delete.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use uuid::Uuid;
88

99
use crate::error::SecretsManagerError;
1010

11+
#[allow(missing_docs)]
1112
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1213
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1314
pub struct ProjectsDeleteRequest {
@@ -27,6 +28,7 @@ pub(crate) async fn delete_projects(
2728
ProjectsDeleteResponse::process_response(res)
2829
}
2930

31+
#[allow(missing_docs)]
3032
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
3133
#[serde(rename_all = "camelCase", deny_unknown_fields)]
3234
pub struct ProjectsDeleteResponse {

bitwarden_license/bitwarden-sm/src/projects/get.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use uuid::Uuid;
55

66
use crate::{error::SecretsManagerError, projects::ProjectResponse};
77

8+
#[allow(missing_docs)]
89
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
910
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1011
pub struct ProjectGetRequest {

bitwarden_license/bitwarden-sm/src/projects/list.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use uuid::Uuid;
77

88
use crate::{error::SecretsManagerError, projects::ProjectResponse};
99

10+
#[allow(missing_docs)]
1011
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1112
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1213
pub struct ProjectsListRequest {
@@ -30,6 +31,7 @@ pub(crate) async fn list_projects(
3031
ProjectsResponse::process_response(res, &mut key_store.context())
3132
}
3233

34+
#[allow(missing_docs)]
3335
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
3436
#[serde(rename_all = "camelCase", deny_unknown_fields)]
3537
pub struct ProjectsResponse {

bitwarden_license/bitwarden-sm/src/projects/project_response.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use uuid::Uuid;
1111

1212
use crate::error::SecretsManagerError;
1313

14+
#[allow(missing_docs)]
1415
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1516
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1617
pub struct ProjectResponse {

bitwarden_license/bitwarden-sm/src/projects/update.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
projects::ProjectResponse,
1212
};
1313

14+
#[allow(missing_docs)]
1415
#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)]
1516
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1617
pub struct ProjectPutRequest {

bitwarden_license/bitwarden-sm/src/secrets/create.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
secrets::SecretResponse,
1212
};
1313

14+
#[allow(missing_docs)]
1415
#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)]
1516
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1617
pub struct SecretCreateRequest {

bitwarden_license/bitwarden-sm/src/secrets/delete.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use uuid::Uuid;
88

99
use crate::error::SecretsManagerError;
1010

11+
#[allow(missing_docs)]
1112
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1213
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1314
pub struct SecretsDeleteRequest {
@@ -27,6 +28,7 @@ pub(crate) async fn delete_secrets(
2728
SecretsDeleteResponse::process_response(res)
2829
}
2930

31+
#[allow(missing_docs)]
3032
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
3133
#[serde(rename_all = "camelCase", deny_unknown_fields)]
3234
pub struct SecretsDeleteResponse {

bitwarden_license/bitwarden-sm/src/secrets/get.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use uuid::Uuid;
55

66
use crate::{error::SecretsManagerError, secrets::SecretResponse};
77

8+
#[allow(missing_docs)]
89
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
910
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1011
pub struct SecretGetRequest {

bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use uuid::Uuid;
66

77
use crate::{error::SecretsManagerError, secrets::SecretsResponse};
88

9+
#[allow(missing_docs)]
910
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1011
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1112
pub struct SecretsGetRequest {

bitwarden_license/bitwarden-sm/src/secrets/list.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use uuid::Uuid;
1313

1414
use crate::error::SecretsManagerError;
1515

16+
#[allow(missing_docs)]
1617
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1718
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1819
pub struct SecretIdentifiersRequest {
@@ -36,6 +37,7 @@ pub(crate) async fn list_secrets(
3637
SecretIdentifiersResponse::process_response(res, &mut key_store.context())
3738
}
3839

40+
#[allow(missing_docs)]
3941
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
4042
#[serde(rename_all = "camelCase", deny_unknown_fields)]
4143
pub struct SecretIdentifiersByProjectRequest {
@@ -59,6 +61,7 @@ pub(crate) async fn list_secrets_by_project(
5961
SecretIdentifiersResponse::process_response(res, &mut key_store.context())
6062
}
6163

64+
#[allow(missing_docs)]
6265
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
6366
#[serde(rename_all = "camelCase", deny_unknown_fields)]
6467
pub struct SecretIdentifiersResponse {

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use uuid::Uuid;
1313

1414
use crate::error::SecretsManagerError;
1515

16+
#[allow(missing_docs)]
1617
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1718
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1819
pub struct SecretResponse {
@@ -84,6 +85,7 @@ impl SecretResponse {
8485
}
8586
}
8687

88+
#[allow(missing_docs)]
8789
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
8890
#[serde(rename_all = "camelCase", deny_unknown_fields)]
8991
pub struct SecretsResponse {

bitwarden_license/bitwarden-sm/src/secrets/sync.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use uuid::Uuid;
88

99
use crate::{error::SecretsManagerError, secrets::SecretResponse};
1010

11+
#[allow(missing_docs)]
1112
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
1213
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1314
pub struct SecretsSyncRequest {
@@ -36,6 +37,7 @@ pub(crate) async fn sync_secrets(
3637
SecretsSyncResponse::process_response(res, &mut key_store.context())
3738
}
3839

40+
#[allow(missing_docs)]
3941
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
4042
#[serde(rename_all = "camelCase", deny_unknown_fields)]
4143
pub struct SecretsSyncResponse {

bitwarden_license/bitwarden-sm/src/secrets/update.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
secrets::SecretResponse,
1212
};
1313

14+
#[allow(missing_docs)]
1415
#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)]
1516
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1617
pub struct SecretPutRequest {

0 commit comments

Comments
 (0)