Skip to content

Commit b59e672

Browse files
committed
Fix clippy warnings
1 parent 94a7f89 commit b59e672

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

bindgen/codegen/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4544,7 +4544,6 @@ pub(crate) mod utils {
45444544
use crate::ir::item::{Item, ItemCanonicalPath};
45454545
use crate::ir::ty::TypeKind;
45464546
use crate::{args_are_cpp, file_is_cpp};
4547-
use proc_macro2;
45484547
use std::borrow::Cow;
45494548
use std::mem;
45504549
use std::path::PathBuf;
@@ -4570,7 +4569,7 @@ pub(crate) mod utils {
45704569
let dir = path.parent().unwrap();
45714570

45724571
if !dir.exists() {
4573-
std::fs::create_dir_all(&dir)?;
4572+
std::fs::create_dir_all(dir)?;
45744573
}
45754574

45764575
let is_cpp = args_are_cpp(&context.options().clang_args) ||

bindgen/ir/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use std::mem;
3737
#[derive(Debug, Copy, Clone, Eq, PartialOrd, Ord, Hash)]
3838
pub(crate) struct ItemId(usize);
3939

40+
/// Declare a newtype around `ItemId` with convesion methods.
4041
macro_rules! item_id_newtype {
4142
(
4243
$( #[$attr:meta] )*
@@ -2809,6 +2810,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
28092810
self.options().must_use_types.matches(name)
28102811
}
28112812

2813+
/// Wrap some tokens in an `unsafe` block if the `--wrap-unsafe-ops` option is enabled.
28122814
pub(crate) fn wrap_unsafe_ops(&self, tokens: impl ToTokens) -> TokenStream {
28132815
if self.options.wrap_unsafe_ops {
28142816
quote!(unsafe { #tokens })
@@ -2817,6 +2819,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
28172819
}
28182820
}
28192821

2822+
/// Get the suffix to be added to `static` functions if the `--wrap-static-fns` option is
2823+
/// enabled.
28202824
pub(crate) fn wrap_static_fns_suffix(&self) -> &str {
28212825
self.options()
28222826
.wrap_static_fns_suffix

bindgen/ir/function.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ impl quote::ToTokens for Abi {
226226
/// An ABI extracted from a clang cursor.
227227
#[derive(Debug, Copy, Clone)]
228228
pub(crate) enum ClangAbi {
229+
/// An ABI known by rust.
229230
Known(Abi),
230231
/// An unknown or invalid ABI.
231232
Unknown(CXCallingConv),
@@ -636,6 +637,7 @@ impl FunctionSig {
636637
matches!(self.abi, ClangAbi::Known(Abi::C) | ClangAbi::Unknown(..))
637638
}
638639

640+
/// Whether this function has attributes marking it as divergent.
639641
pub(crate) fn is_divergent(&self) -> bool {
640642
self.is_divergent
641643
}

bindgen/ir/item.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,7 @@ fn visit_child(
13081308
}
13091309

13101310
impl Item {
1311+
/// Create a builtin type.
13111312
pub(crate) fn builtin_type(
13121313
kind: TypeKind,
13131314
is_const: bool,
@@ -1333,6 +1334,7 @@ impl Item {
13331334
id.as_type_id_unchecked()
13341335
}
13351336

1337+
/// Parse this item from the given Clang cursor.
13361338
pub(crate) fn parse(
13371339
cursor: clang::Cursor,
13381340
parent_id: Option<ItemId>,
@@ -1351,6 +1353,7 @@ impl Item {
13511353
let current_module = ctx.current_module().into();
13521354
let relevant_parent_id = parent_id.unwrap_or(current_module);
13531355

1356+
#[allow(clippy::missing_docs_in_private_items)]
13541357
macro_rules! try_parse {
13551358
($what:ident) => {
13561359
match $what::parse(cursor, ctx) {
@@ -1479,6 +1482,8 @@ impl Item {
14791482
}
14801483
}
14811484

1485+
/// Parse this item from the given Clang type, or if we haven't resolved all
1486+
/// the other items this one depends on, an unresolved reference.
14821487
pub(crate) fn from_ty_or_ref(
14831488
ty: clang::Type,
14841489
location: clang::Cursor,
@@ -1554,6 +1559,7 @@ impl Item {
15541559
potential_id.as_type_id_unchecked()
15551560
}
15561561

1562+
/// Parse this item from the given Clang type. See [`Item::from_ty_with_id`].
15571563
pub(crate) fn from_ty(
15581564
ty: &clang::Type,
15591565
location: clang::Cursor,

0 commit comments

Comments
 (0)