Skip to content

Commit 7959167

Browse files
authored
Merge pull request #480 from madsmtm/more-warnings
Add more warnings to crate root
2 parents b832f25 + b9933b5 commit 7959167

File tree

34 files changed

+762
-693
lines changed

34 files changed

+762
-693
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ jobs:
181181
$PUBLIC_CRATES
182182
--features=$INTERESTING_FEATURES
183183
--features=$LATEST_MACOS_FEATURE
184+
env:
185+
RUSTFLAGS: "--codegen=debuginfo=0" # Removed --deny=warnings
184186

185187
ui:
186188
name: Compiler UI

crates/block-sys/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414

1515
#![no_std]
1616
#![warn(elided_lifetimes_in_paths)]
17+
#![warn(missing_copy_implementations)]
1718
#![deny(non_ascii_idents)]
1819
#![warn(unreachable_pub)]
1920
#![deny(unsafe_op_in_unsafe_fn)]
2021
#![warn(clippy::cargo)]
2122
#![warn(clippy::ptr_as_ptr)]
23+
#![warn(clippy::missing_errors_doc)]
24+
#![warn(clippy::missing_panics_doc)]
2225
// Update in Cargo.toml as well.
2326
#![doc(html_root_url = "https://docs.rs/block-sys/0.2.0")]
2427
#![cfg_attr(feature = "unstable-docsrs", feature(doc_auto_cfg, doc_cfg_hide))]
@@ -291,6 +294,7 @@ pub struct Block_layout {
291294
}
292295

293296
#[repr(C)]
297+
#[allow(missing_copy_implementations)]
294298
pub struct Block_descriptor_header {
295299
/// Reserved for future use. Currently always 0.
296300
pub reserved: c_ulong, // usize

crates/block2/src/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<A: BlockArguments, R: EncodeReturn> Block<A, R> {
116116
let ptr: *const Self = self;
117117
let layout = unsafe { ptr.cast::<ffi::Block_layout>().as_ref().unwrap_unchecked() };
118118
// TODO: Is `invoke` actually ever null?
119-
let invoke = layout.invoke.unwrap();
119+
let invoke = layout.invoke.unwrap_or_else(|| unreachable!());
120120

121121
unsafe { A::__call_block(invoke, ptr as *mut Self, args) }
122122
}

crates/block2/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@
7676
7777
#![no_std]
7878
#![warn(elided_lifetimes_in_paths)]
79+
#![warn(missing_copy_implementations)]
80+
#![warn(missing_debug_implementations)]
7981
#![warn(missing_docs)]
8082
#![deny(non_ascii_idents)]
8183
#![warn(unreachable_pub)]
8284
#![deny(unsafe_op_in_unsafe_fn)]
8385
#![warn(clippy::cargo)]
8486
#![warn(clippy::ptr_as_ptr)]
87+
#![warn(clippy::missing_errors_doc)]
88+
#![warn(clippy::missing_panics_doc)]
8589
// Update in Cargo.toml as well.
8690
#![doc(html_root_url = "https://docs.rs/block2/0.3.0")]
8791

crates/icrate/src/Foundation/__macro_helpers/cached.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use objc2::rc::Id;
66
use objc2::Message;
77

88
/// Allows storing an `Id` in a static and lazily loading it.
9+
#[derive(Debug)]
910
pub struct CachedId<T> {
1011
ptr: AtomicPtr<T>,
1112
}

crates/icrate/src/Foundation/__macro_helpers/ns_string.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![cfg(feature = "Foundation_NSString")]
2+
#![allow(missing_copy_implementations)]
23
//! Macro for making a static NSString.
34
//!
45
//! This closely follows what clang does, see:
@@ -37,6 +38,7 @@ extern "C" {
3738
/// [`CFRuntimeBase`]: <https://github.com/apple-oss-distributions/CF/blob/CF-1153.18/CFRuntime.h#L216-L228>
3839
/// [`CF_CONST_STRING`]: <https://github.com/apple-oss-distributions/CF/blob/CF-1153.18/CFInternal.h#L332-L336>
3940
#[repr(C)]
41+
#[derive(Debug)]
4042
pub struct CFConstString {
4143
isa: &'static AnyClass,
4244
// Important that we don't use `usize` here, since that would be wrong on
@@ -118,6 +120,7 @@ pub const fn is_ascii_no_nul(bytes: &[u8]) -> bool {
118120
true
119121
}
120122

123+
#[derive(Debug)]
121124
pub struct Utf16Char {
122125
pub repr: [u16; 2],
123126
pub len: usize,
@@ -147,6 +150,7 @@ impl Utf16Char {
147150
}
148151
}
149152

153+
#[derive(Debug)]
150154
pub struct EncodeUtf16Iter {
151155
str: &'static [u8],
152156
index: usize,

crates/icrate/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#![no_std]
88
#![cfg_attr(feature = "unstable-docsrs", feature(doc_auto_cfg))]
99
#![warn(elided_lifetimes_in_paths)]
10+
#![warn(missing_copy_implementations)]
11+
#![warn(missing_debug_implementations)]
1012
#![deny(non_ascii_idents)]
1113
#![warn(unreachable_pub)]
1214
#![deny(unsafe_op_in_unsafe_fn)]

crates/objc-sys/src/image_info.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/// only used behind experimental features (`unstable-static-*`).
66
#[repr(C)]
77
#[doc(hidden)]
8+
#[allow(missing_copy_implementations)]
89
pub struct __ImageInfo {
910
// These are not actually `unsigned int`, even though the docs say so
1011
/// The version of the image info struct.

crates/objc-sys/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
1616
#![no_std]
1717
#![warn(elided_lifetimes_in_paths)]
18+
#![warn(missing_copy_implementations)]
1819
#![deny(non_ascii_idents)]
1920
#![warn(unreachable_pub)]
2021
#![deny(unsafe_op_in_unsafe_fn)]
2122
#![warn(clippy::cargo)]
2223
#![warn(clippy::ptr_as_ptr)]
24+
#![warn(clippy::missing_errors_doc)]
25+
#![warn(clippy::missing_panics_doc)]
2326
#![allow(clippy::upper_case_acronyms)]
2427
#![allow(non_camel_case_types)]
2528
#![allow(non_upper_case_globals)]

crates/objc2-encode/src/encoding.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ use crate::EncodingBox;
3434
/// use objc2_encode::Encoding;
3535
/// assert!(Encoding::Array(10, &Encoding::FloatComplex).equivalent_to_str("[10jf]"));
3636
/// ```
37-
// Not `Copy`, since this may one day contain `Box`
37+
// Not `Copy`, since this may one day be merged with `EncodingBox`
38+
#[allow(missing_copy_implementations)]
3839
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
3940
// See <https://en.cppreference.com/w/c/language/type>
4041
#[non_exhaustive] // Maybe we're missing some encodings?

0 commit comments

Comments
 (0)