Skip to content

Commit 35e7078

Browse files
nyurikemilio
authored andcommitted
Fix some markdown
First ran this ``` cargo clippy --fix --workspace --exclude bindgen-integration --exclude tests_expectations -- -W clippy::doc_markdown ``` followed by a bunch of manual fixes.
1 parent c171414 commit 35e7078

File tree

20 files changed

+128
-129
lines changed

20 files changed

+128
-129
lines changed

bindgen-tests/tests/quickchecking/src/fuzzers.rs

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

bindgen/callbacks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub trait ParseCallbacks: fmt::Debug {
169169
// TODO add callback for ResolvedTypeRef
170170
}
171171

172-
/// An identifier for a discovered item. Used to identify an aliased type (see [DiscoveredItem::Alias])
172+
/// An identifier for a discovered item. Used to identify an aliased type (see [`DiscoveredItem::Alias`])
173173
#[derive(Ord, PartialOrd, PartialEq, Eq, Hash, Debug, Clone, Copy)]
174174
pub struct DiscoveredItemId(usize);
175175

@@ -180,7 +180,7 @@ impl DiscoveredItemId {
180180
}
181181
}
182182

183-
/// Struct passed to [ParseCallbacks::new_item_found] containing information about discovered
183+
/// Struct passed to [`ParseCallbacks::new_item_found`] containing information about discovered
184184
/// items (struct, union, and alias)
185185
#[derive(Debug, Hash, Clone, Ord, PartialOrd, Eq, PartialEq)]
186186
pub enum DiscoveredItem {
@@ -262,7 +262,7 @@ pub struct ItemInfo<'a> {
262262
pub kind: ItemKind,
263263
}
264264

265-
/// An enum indicating the kind of item for an ItemInfo.
265+
/// An enum indicating the kind of item for an `ItemInfo`.
266266
#[non_exhaustive]
267267
pub enum ItemKind {
268268
/// A Function

bindgen/clang.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ impl Cursor {
878878

879879
/// Is the cursor's referent publicly accessible in C++?
880880
///
881-
/// Returns true if self.access_specifier() is `CX_CXXPublic` or
881+
/// Returns true if `self.access_specifier()` is `CX_CXXPublic` or
882882
/// `CX_CXXInvalidAccessSpecifier`.
883883
pub(crate) fn public_accessible(&self) -> bool {
884884
let access = self.access_specifier();
@@ -957,7 +957,7 @@ impl Cursor {
957957
.collect()
958958
}
959959

960-
/// Obtain the real path name of a cursor of InclusionDirective kind.
960+
/// Obtain the real path name of a cursor of `InclusionDirective` kind.
961961
///
962962
/// Returns None if the cursor does not include a file, otherwise the file's full name
963963
pub(crate) fn get_included_file_name(&self) -> Option<String> {
@@ -1051,7 +1051,7 @@ impl ClangToken {
10511051
c_str.to_bytes()
10521052
}
10531053

1054-
/// Converts a ClangToken to a `cexpr` token if possible.
1054+
/// Converts a `ClangToken` to a `cexpr` token if possible.
10551055
pub(crate) fn as_cexpr_token(&self) -> Option<cexpr::token::Token> {
10561056
use cexpr::token;
10571057

bindgen/codegen/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub(crate) mod attributes {
7676
}
7777

7878
/// The `ffi_safe` argument should be true if this is a type that the user might
79-
/// reasonably use, e.g. not struct padding, where the __BindgenOpaqueArray is
79+
/// reasonably use, e.g. not struct padding, where the `__BindgenOpaqueArray` is
8080
/// just noise.
8181
/// TODO: Should this be `MaybeUninit`, since padding bytes are effectively
8282
/// uninitialized?

bindgen/codegen/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,7 +3161,7 @@ impl Method {
31613161
pub enum EnumVariation {
31623162
/// The code for this enum will use a Rust enum. Note that creating this in unsafe code
31633163
/// (including FFI) with an invalid value will invoke undefined behaviour, whether or not
3164-
/// its marked as non_exhaustive.
3164+
/// its marked as `#[non_exhaustive]`.
31653165
Rust {
31663166
/// Indicates whether the generated struct should be `#[non_exhaustive]`
31673167
non_exhaustive: bool,
@@ -3953,7 +3953,7 @@ pub enum AliasVariation {
39533953
TypeAlias,
39543954
/// Create a new type by wrapping the old type in a struct and using #[repr(transparent)]
39553955
NewType,
3956-
/// Same as NewStruct but also impl Deref to be able to use the methods of the wrapped type
3956+
/// Same as `NewType` but also impl Deref to be able to use the methods of the wrapped type
39573957
NewTypeDeref,
39583958
}
39593959

@@ -4156,7 +4156,7 @@ where
41564156
/// implementations that need to convert another thing into a Rust type or
41574157
/// opaque blob in a nested manner should also use fallible trait methods and
41584158
/// propagate failure up the stack. Only infallible functions and methods like
4159-
/// CodeGenerator implementations should use the infallible
4159+
/// `CodeGenerator` implementations should use the infallible
41604160
/// `ToRustTyOrOpaque`. The further out we push error recovery, the more likely
41614161
/// we are to get a usable `Layout` even if we can't generate an equivalent Rust
41624162
/// type for a C++ construct.

bindgen/codegen/struct_layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl<'a> StructLayoutTracker<'a> {
414414

415415
/// Returns whether the new field is known to merge with a bitfield.
416416
///
417-
/// This is just to avoid doing the same check also in pad_field.
417+
/// This is just to avoid doing the same check also in `pad_field`.
418418
fn align_to_latest_field(&mut self, new_field_layout: Layout) -> bool {
419419
if self.is_packed {
420420
// Skip to align fields when packed.

bindgen/extra_assertions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! and/or CI when the `__testing_only_extra_assertions` feature is enabled.
33
44
/// Simple macro that forwards to assert! when using
5-
/// __testing_only_extra_assertions.
5+
/// `__testing_only_extra_assertions`.
66
macro_rules! extra_assert {
77
( $cond:expr ) => {
88
if cfg!(feature = "__testing_only_extra_assertions") {

bindgen/ir/analysis/has_vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'ctx> From<HasVtableAnalysis<'ctx>> for HashMap<ItemId, HasVtableResult> {
223223
/// vtable during codegen.
224224
///
225225
/// This is not for _computing_ whether the thing has a vtable, it is for
226-
/// looking up the results of the HasVtableAnalysis's computations for a
226+
/// looking up the results of the `HasVtableAnalysis`'s computations for a
227227
/// specific thing.
228228
pub(crate) trait HasVtable {
229229
/// Return `true` if this thing has vtable, `false` otherwise.

bindgen/ir/comp.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ pub(crate) struct CompInfo {
10171017

10181018
/// The inner types that were declared inside this class, in something like:
10191019
///
1020+
/// ```c++
10201021
/// class Foo {
10211022
/// typedef int FooTy;
10221023
/// struct Bar {
@@ -1025,6 +1026,7 @@ pub(crate) struct CompInfo {
10251026
/// }
10261027
///
10271028
/// static Foo::Bar const = {3};
1029+
/// ```
10281030
inner_types: Vec<TypeId>,
10291031

10301032
/// Set of static constants declared inside this class.
@@ -1043,7 +1045,7 @@ pub(crate) struct CompInfo {
10431045
has_nonempty_base: bool,
10441046

10451047
/// If this type has a template parameter which is not a type (e.g.: a
1046-
/// size_t)
1048+
/// `size_t`)
10471049
has_non_type_template_params: bool,
10481050

10491051
/// Whether this type has a bit field member whose width couldn't be
@@ -1056,7 +1058,7 @@ pub(crate) struct CompInfo {
10561058

10571059
/// Used to know if we've found an opaque attribute that could cause us to
10581060
/// generate a type with invalid layout. This is explicitly used to avoid us
1059-
/// generating bad alignments when parsing types like max_align_t.
1061+
/// generating bad alignments when parsing types like `max_align_t`.
10601062
///
10611063
/// It's not clear what the behavior should be here, if generating the item
10621064
/// and pray, or behave as an opaque type.
@@ -1098,7 +1100,7 @@ impl CompInfo {
10981100
///
10991101
/// If we're a union without known layout, we try to compute it from our
11001102
/// members. This is not ideal, but clang fails to report the size for these
1101-
/// kind of unions, see test/headers/template_union.hpp
1103+
/// kind of unions, see `test/headers/template_union.hpp`
11021104
pub(crate) fn layout(&self, ctx: &BindgenContext) -> Option<Layout> {
11031105
// We can't do better than clang here, sorry.
11041106
if self.kind == CompKind::Struct {
@@ -1213,7 +1215,7 @@ impl CompInfo {
12131215
}
12141216

12151217
/// Do we see a virtual function during parsing?
1216-
/// Get the has_own_virtual_method boolean.
1218+
/// Get the `has_own_virtual_method` boolean.
12171219
pub(crate) fn has_own_virtual_method(&self) -> bool {
12181220
self.has_own_virtual_method
12191221
}
@@ -1708,12 +1710,12 @@ impl CompInfo {
17081710
/// Returns whether the current union can be represented as a Rust `union`
17091711
///
17101712
/// Requirements:
1711-
/// 1. Current RustTarget allows for `untagged_union`
1712-
/// 2. Each field can derive `Copy` or we use ManuallyDrop.
1713+
/// 1. Current `RustTarget` allows for `untagged_union`
1714+
/// 2. Each field can derive `Copy` or we use `ManuallyDrop`.
17131715
/// 3. It's not zero-sized.
17141716
///
17151717
/// Second boolean returns whether all fields can be copied (and thus
1716-
/// ManuallyDrop is not needed).
1718+
/// `ManuallyDrop` is not needed).
17171719
pub(crate) fn is_rust_union(
17181720
&self,
17191721
ctx: &BindgenContext,

bindgen/ir/context.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ enum TypeKey {
310310
/// A context used during parsing and generation of structs.
311311
#[derive(Debug)]
312312
pub(crate) struct BindgenContext {
313-
/// The map of all the items parsed so far, keyed off ItemId.
313+
/// The map of all the items parsed so far, keyed off `ItemId`.
314314
items: Vec<Option<Item>>,
315315

316316
/// Clang USR to type map. This is needed to be able to associate types with
@@ -330,7 +330,7 @@ pub(crate) struct BindgenContext {
330330
/// Current module being traversed.
331331
current_module: ModuleId,
332332

333-
/// A HashMap keyed on a type definition, and whose value is the parent ID
333+
/// A `HashMap` keyed on a type definition, and whose value is the parent ID
334334
/// of the declaration.
335335
///
336336
/// This is used to handle the cases where the semantic and the lexical
@@ -346,7 +346,7 @@ pub(crate) struct BindgenContext {
346346
/// This means effectively, that a type has a potential ID before knowing if
347347
/// it's a correct type. But that's not important in practice.
348348
///
349-
/// We could also use the `types` HashMap, but my intention with it is that
349+
/// We could also use the `types` `HashMap`, but my intention with it is that
350350
/// only valid types and declarations end up there, and this could
351351
/// potentially break that assumption.
352352
currently_parsed_types: Vec<PartialType>,
@@ -355,7 +355,7 @@ pub(crate) struct BindgenContext {
355355
/// hard errors while parsing duplicated macros, as well to allow macro
356356
/// expression parsing.
357357
///
358-
/// This needs to be an std::HashMap because the cexpr API requires it.
358+
/// This needs to be an `std::HashMap` because the `cexpr` API requires it.
359359
parsed_macros: StdHashMap<Vec<u8>, cexpr::expr::EvalResult>,
360360

361361
/// A map with all include locations.
@@ -623,7 +623,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
623623
self.target_info.triple.starts_with("wasm32-")
624624
}
625625

626-
/// Creates a timer for the current bindgen phase. If time_phases is `true`,
626+
/// Creates a timer for the current bindgen phase. If `time_phases` is `true`,
627627
/// the timer will print to stderr when it is dropped, otherwise it will do
628628
/// nothing.
629629
pub(crate) fn timer<'a>(&self, name: &'a str) -> Timer<'a> {
@@ -1219,7 +1219,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
12191219

12201220
/// When the `__testing_only_extra_assertions` feature is enabled, this
12211221
/// function walks the IR graph and asserts that we do not have any edges
1222-
/// referencing an ItemId for which we do not have an associated IR item.
1222+
/// referencing an `ItemId` for which we do not have an associated IR item.
12231223
fn assert_no_dangling_references(&self) {
12241224
if cfg!(feature = "__testing_only_extra_assertions") {
12251225
for _ in self.assert_no_dangling_item_traversal() {
@@ -1506,7 +1506,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
15061506
/// correct type definition afterwards.
15071507
///
15081508
/// TODO(emilio): We could consider doing this only when
1509-
/// declaration.lexical_parent() != definition.lexical_parent(), but it's
1509+
/// `declaration.lexical_parent() != definition.lexical_parent()`, but it's
15101510
/// not sure it's worth it.
15111511
pub(crate) fn add_semantic_parent(
15121512
&mut self,
@@ -1593,7 +1593,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
15931593
/// function template declarations(!?!??!).
15941594
///
15951595
/// The only way to do this is manually inspecting the AST and looking for
1596-
/// TypeRefs and TemplateRefs inside. This, unfortunately, doesn't work for
1596+
/// `TypeRefs` and `TemplateRefs` inside. This, unfortunately, doesn't work for
15971597
/// more complex cases, see the comment on the assertion below.
15981598
///
15991599
/// To add insult to injury, the AST itself has structure that doesn't make
@@ -2297,7 +2297,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
22972297
(module_name, kind)
22982298
}
22992299

2300-
/// Given a CXCursor_Namespace cursor, return the item ID of the
2300+
/// Given a `CXCursor_Namespace` cursor, return the item ID of the
23012301
/// corresponding module, or create one on the fly.
23022302
pub(crate) fn module(&mut self, cursor: Cursor) -> ModuleId {
23032303
use clang_sys::*;
@@ -2806,7 +2806,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
28062806
!self.cannot_derive_hash.as_ref().unwrap().contains(&id)
28072807
}
28082808

2809-
/// Compute whether we can derive PartialOrd, PartialEq or Eq.
2809+
/// Compute whether we can derive `PartialOrd`, `PartialEq` or `Eq`.
28102810
fn compute_cannot_derive_partialord_partialeq_or_eq(&mut self) {
28112811
let _t = self.timer("compute_cannot_derive_partialord_partialeq_or_eq");
28122812
assert!(self.cannot_derive_partialeq_or_partialord.is_none());

bindgen/ir/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub(crate) struct Function {
8282
/// The mangled name, that is, the symbol.
8383
mangled_name: Option<String>,
8484

85-
/// The link name. If specified, overwrite mangled_name.
85+
/// The link name. If specified, overwrite `mangled_name`.
8686
link_name: Option<String>,
8787

8888
/// The ID pointing to the current function signature.

bindgen/ir/item.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub(crate) trait ItemCanonicalName {
4444

4545
/// The same, but specifies the path that needs to be followed to reach an item.
4646
///
47-
/// To contrast with canonical_name, here's an example:
47+
/// To contrast with `canonical_name`, here's an example:
4848
///
4949
/// ```c++
5050
/// namespace foo {
@@ -375,7 +375,7 @@ pub(crate) struct Item {
375375
/// The item's local ID, unique only amongst its siblings. Only used for
376376
/// anonymous items.
377377
///
378-
/// Lazily initialized in local_id().
378+
/// Lazily initialized in `local_id()`.
379379
///
380380
/// Note that only structs, unions, and enums get a local type ID. In any
381381
/// case this is an implementation detail.
@@ -668,7 +668,7 @@ impl Item {
668668
}
669669
}
670670

671-
/// Take out item NameOptions
671+
/// Take out item `NameOptions`
672672
pub(crate) fn name<'a>(
673673
&'a self,
674674
ctx: &'a BindgenContext,
@@ -716,7 +716,7 @@ impl Item {
716716
s
717717
}
718718

719-
/// Helper function for full_disambiguated_name
719+
/// Helper function for `full_disambiguated_name`
720720
fn push_disambiguated_name(
721721
&self,
722722
ctx: &BindgenContext,

bindgen/ir/objc.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ use clang_sys::CXCursor_ObjCSuperClassRef;
1717
use clang_sys::CXCursor_TemplateTypeParameter;
1818
use proc_macro2::{Ident, Span, TokenStream};
1919

20-
/// Objective C interface as used in TypeKind
20+
/// Objective-C interface as used in `TypeKind`
2121
///
22-
/// Also protocols and categories are parsed as this type
22+
/// Also, protocols and categories are parsed as this type
2323
#[derive(Debug)]
2424
pub(crate) struct ObjCInterface {
2525
/// The name
26-
/// like, NSObject
26+
/// like, `NSObject`
2727
name: String,
2828

2929
category: Option<String>,
3030

3131
is_protocol: bool,
3232

33-
/// The list of template names almost always, ObjectType or KeyType
33+
/// The list of template names almost always, `ObjectType` or `KeyType`
3434
pub(crate) template_names: Vec<String>,
3535

3636
/// The list of protocols that this interface conforms to.
@@ -53,7 +53,7 @@ pub(crate) struct ObjCMethod {
5353
name: String,
5454

5555
/// Method name as converted to rust
56-
/// like, dataWithBytes_length_
56+
/// like, `dataWithBytes_length`_
5757
rust_name: String,
5858

5959
signature: FunctionSig,
@@ -77,14 +77,14 @@ impl ObjCInterface {
7777
}
7878

7979
/// The name
80-
/// like, NSObject
80+
/// like, `NSObject`
8181
pub(crate) fn name(&self) -> &str {
8282
self.name.as_ref()
8383
}
8484

8585
/// Formats the name for rust
86-
/// Can be like NSObject, but with categories might be like NSObject_NSCoderMethods
87-
/// and protocols are like PNSObject
86+
/// Can be like `NSObject`, but with categories might be like `NSObject_NSCoderMethods`
87+
/// and protocols are like `PNSObject`
8888
pub(crate) fn rust_name(&self) -> String {
8989
if let Some(ref cat) = self.category {
9090
format!("{}_{cat}", self.name())
@@ -227,12 +227,12 @@ impl ObjCMethod {
227227
}
228228

229229
/// Method name as converted to rust
230-
/// like, dataWithBytes_length_
230+
/// like, `dataWithBytes_length`_
231231
pub(crate) fn rust_name(&self) -> &str {
232232
self.rust_name.as_ref()
233233
}
234234

235-
/// Returns the methods signature as FunctionSig
235+
/// Returns the methods signature as `FunctionSig`
236236
pub(crate) fn signature(&self) -> &FunctionSig {
237237
&self.signature
238238
}

0 commit comments

Comments
 (0)