Skip to content

Commit

Permalink
Put extra warnings for stack blowups
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Jun 2, 2024
1 parent d08fe8f commit e373cc9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
future-size-threshold = 2048
stack-size-threshold = 2048
pass-by-value-size-limit = 16
large-error-threshold = 64
7 changes: 6 additions & 1 deletion src/ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct State {
response: GattResponse,
}

#[derive(Debug, Clone)]
#[derive(Debug)]
struct IndBuffer {
addr: BtAddr,
data: heapless::Vec<u8, MAX_MTU_SIZE>,
Expand All @@ -73,6 +73,8 @@ pub struct BtpGattContext {

impl BtpGattContext {
/// Create a new instance.
#[allow(clippy::large_stack_frames)]
#[inline(always)]
pub const fn new() -> Self {
Self {
state: Mutex::new(RefCell::new(State {
Expand Down Expand Up @@ -120,6 +122,9 @@ impl BtpGattContext {
}

impl Default for BtpGattContext {
// TODO
#[allow(clippy::large_stack_frames)]
#[inline(always)]
fn default() -> Self {
Self::new()
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#![allow(unexpected_cfgs)]
#![allow(clippy::declare_interior_mutable_const)]
#![warn(clippy::large_futures)]
#![warn(clippy::large_stack_frames)]
#![warn(clippy::large_types_passed_by_value)]

#[cfg(feature = "std")]
#[allow(unused_imports)]
Expand Down
2 changes: 2 additions & 0 deletions src/stack/wifible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ impl<E> EspGatt<E>
where
E: Embedding,
{
#[allow(clippy::large_stack_frames)]
#[inline(always)]
const fn new() -> Self {
Self {
btp_gatt_context: BtpGattContext::new(),
Expand Down

0 comments on commit e373cc9

Please sign in to comment.