Skip to content

Commit

Permalink
Enable workspace lint missing_docs (#2799)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Jan 17, 2024
1 parent 6b1c3ff commit 587520b
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ exclude = [
[workspace.lints.rust]
rust_2018_idioms = "warn"
unused_qualifications = "warn"
missing_docs = "warn"
2 changes: 2 additions & 0 deletions crates/libs/bindgen/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// A specialized [`Result`] type that provides compiler error information.
pub type Result<T> = std::result::Result<T, Error>;

/// An error object consists of both an error message and file and line information.
#[derive(Default, Debug)]
pub struct Error {
message: String,
Expand Down
5 changes: 5 additions & 0 deletions crates/libs/bindgen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/

mod args;
mod error;
mod metadata;
Expand All @@ -18,6 +22,7 @@ enum ArgKind {
Config,
}

/// Windows metadata compiler.
pub fn bindgen<I, S>(args: I) -> Result<String>
where
I: IntoIterator<Item = S>,
Expand Down
7 changes: 7 additions & 0 deletions crates/libs/core/src/guid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ use super::*;
#[repr(C)]
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct GUID {
/// Specifies the first 8 hexadecimal digits.
pub data1: u32,

/// Specifies the first group of 4 hexadecimal digits.
pub data2: u16,

/// Specifies the second group of 4 hexadecimal digits.
pub data3: u16,

/// The first 2 bytes contain the third group of 4 hexadecimal digits. The remaining 6 bytes contain the final 12 hexadecimal digits.
pub data4: [u8; 8],
}

Expand Down
5 changes: 5 additions & 0 deletions crates/libs/core/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ use super::*;
///
/// # Safety
pub unsafe trait Interface: Sized + Clone {
#[doc(hidden)]
type Vtable;

#[doc(hidden)]
const IID: GUID;

#[doc(hidden)]
const UNKNOWN: bool = true;

/// A reference to the interface's vtable
Expand Down
1 change: 1 addition & 0 deletions crates/libs/core/src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl<T: Type<T>> Param<T> {
}
}

#[doc(hidden)]
pub trait CanInto<T>: Sized {
const QUERY: bool = false;
}
Expand Down
10 changes: 10 additions & 0 deletions crates/libs/core/src/variant.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use super::*;

/// A VARIANT ([VARIANT](https://learn.microsoft.com/en-us/windows/win32/api/oaidl/ns-oaidl-variant)) is a container that can store different types of values.
#[repr(transparent)]
pub struct VARIANT(imp::VARIANT);

/// A PROPVARIANT ([PROPVARIANT](https://learn.microsoft.com/en-us/windows/win32/api/propidlbase/ns-propidlbase-propvariant)) is a container that can store different types of values.
#[repr(transparent)]
pub struct PROPVARIANT(imp::PROPVARIANT);

Expand Down Expand Up @@ -130,20 +132,28 @@ impl Eq for VARIANT {}
impl Eq for PROPVARIANT {}

impl VARIANT {
/// Create an empty `VARIANT`.
///
/// This function does not allocate memory.
pub fn new() -> Self {
unsafe { std::mem::zeroed() }
}

/// Returns true if the `VARIANT` is empty.
pub const fn is_empty(&self) -> bool {
unsafe { self.0.Anonymous.Anonymous.vt == imp::VT_EMPTY }
}
}

impl PROPVARIANT {
/// Create an empty `PROPVARIANT`.
///
/// This function does not allocate memory.
pub fn new() -> Self {
unsafe { std::mem::zeroed() }
}

/// Returns true if the `PROPVARIANT` is empty.
pub const fn is_empty(&self) -> bool {
unsafe { self.0.Anonymous.Anonymous.vt == imp::VT_EMPTY }
}
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/implement/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/

use quote::{quote, ToTokens};

/// Implements one or more COM interfaces.
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/interface/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/

use quote::quote;
use syn::spanned::Spanned;

Expand Down
6 changes: 6 additions & 0 deletions crates/libs/metadata/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/

#![doc(hidden)]

use std::cmp::Ordering;
use std::collections::*;

Expand Down
2 changes: 1 addition & 1 deletion crates/libs/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs

#![no_std]
#![doc(html_no_source)]
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, clippy::all)]
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, missing_docs, clippy::all)]
#![cfg_attr(not(feature = "docs"), doc(hidden))]

#[allow(unused_extern_crates)]
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/targets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs

#![no_std]

/// Defines an external function to import.
#[cfg(all(windows_raw_dylib, target_arch = "x86"))]
#[macro_export]
macro_rules! link {
Expand All @@ -17,6 +18,7 @@ macro_rules! link {
)
}

/// Defines an external function to import.
#[cfg(all(windows_raw_dylib, not(target_arch = "x86")))]
#[macro_export]
macro_rules! link {
Expand All @@ -30,6 +32,7 @@ macro_rules! link {
)
}

/// Defines an external function to import.
#[cfg(all(windows, not(windows_raw_dylib)))]
#[macro_export]
macro_rules! link {
Expand All @@ -43,6 +46,7 @@ macro_rules! link {
)
}

/// Defines an external function to import.
#[cfg(all(not(windows), not(windows_raw_dylib)))]
#[macro_export]
macro_rules! link {
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/version/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/

#![cfg_attr(not(test), no_std)]

mod bindings;
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/windows/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs
*/

#![doc(html_no_source)]
#![allow(non_snake_case, clashing_extern_declarations, non_upper_case_globals, non_camel_case_types, clippy::all)]
#![allow(non_snake_case, clashing_extern_declarations, non_upper_case_globals, non_camel_case_types, missing_docs, clippy::all)]
#![cfg_attr(not(feature = "docs"), doc(hidden))]

#[allow(unused_extern_crates)]
Expand Down

0 comments on commit 587520b

Please sign in to comment.