Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added missing_debug_implementations lint #2016

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/sozo/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tracing_subscriber::{fmt, EnvFilter};
use crate::commands::Commands;
use crate::utils::generate_version;

#[derive(Parser)]
#[derive(Parser, Debug)]
#[command(author, version=generate_version(), about, long_about = None)]
#[command(propagate_version = true)]
pub struct SozoArgs {
Expand Down
2 changes: 2 additions & 0 deletions bin/sozo/src/commands/options/account/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use url::Url;

use super::WorldAddressOrName;

// This type comes from account_sdk, which doesn't derive Debug.
#[allow(missing_debug_implementations)]
pub type ControllerSessionAccount<P> = SessionAccount<P, SigningKey, SigningKey>;

/// Create a new Catridge Controller account based on session key.
Expand Down
1 change: 1 addition & 0 deletions bin/sozo/src/commands/options/account/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub enum SozoAccountSignError {
#[must_use]
#[non_exhaustive]
#[derive(derive_more::From)]
#[allow(missing_debug_implementations)]
pub enum SozoAccount<P>
where
P: Send,
Expand Down
2 changes: 1 addition & 1 deletion crates/benches/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use starknet::signers::LocalWallet;
use tokio::sync::OnceCell;

pub type OwnerAccount = SingleOwnerAccount<JsonRpcClient<HttpTransport>, LocalWallet>;
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct BenchCall(pub &'static str, pub Vec<Felt>);

// Because no calls are actually executed in the benchmark, we can use the same nonce for all of
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-bindgen/src/plugins/unity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::error::BindgenResult;
use crate::plugins::BuiltinPlugin;
use crate::{DojoContract, DojoData, DojoModel};

#[derive(Debug)]
pub struct UnityPlugin {}

impl UnityPlugin {
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-lang/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub(crate) const LOG_TARGET: &str = "dojo_lang::compiler";
#[path = "compiler_test.rs"]
mod test;

#[derive(Debug)]
pub struct DojoCompiler;

#[derive(Debug, Default, Serialize, Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion crates/dojo-lang/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ use crate::utils::is_name_valid;
const DOJO_INIT_FN: &str = "dojo_init";
const CONTRACT_NAMESPACE: &str = "namespace";

#[derive(Clone, Default)]
#[derive(Debug, Clone, Default)]
pub struct ContractParameters {
namespace: Option<String>,
}

#[derive(Debug)]
pub struct DojoContract {
diagnostics: Vec<PluginDiagnostic>,
dependencies: HashMap<smol_str::SmolStr, Dependency>,
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-lang/src/inline_macros/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ lazy_static::lazy_static! {
pub static ref SYSTEM_READS: Mutex<HashMap<ModuleName, Vec<String>>> = Default::default();
}

#[derive(Debug)]
pub enum SystemRWOpRecord {
StructCtor(ExprStructCtorCall),
Path(ExprPath),
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-lang/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use cairo_lang_utils::unordered_hash_map::UnorderedHashMap;
use crate::syntax::self_param;
use crate::syntax::world_param::{self, WorldParamInjectionKind};

#[derive(Debug)]
pub struct DojoInterface {
diagnostics: Vec<PluginDiagnostic>,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-lang/src/introspect/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

#[derive(Clone, Default)]
#[derive(Clone, Default, Debug)]
pub struct TypeIntrospection(pub usize, pub Vec<usize>);

// Provides type introspection information for primitive types
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-lang/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ impl MacroPlugin for BuiltinDojoPlugin {
}
}

#[derive(Debug)]
pub struct CairoPluginRepository(scarb::compiler::plugin::CairoPluginRepository);

impl Default for CairoPluginRepository {
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-lang/src/plugin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub fn test_expand_plugin(
}

#[salsa::database(DefsDatabase, ParserDatabase, SyntaxDatabase, FilesDatabase)]
#[allow(missing_debug_implementations)]
pub struct DatabaseForTesting {
storage: salsa::Storage<DatabaseForTesting>,
}
Expand Down
5 changes: 5 additions & 0 deletions crates/dojo-lang/src/semantics/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use once_cell::sync::Lazy;
use crate::plugin::dojo_plugin_suite;

#[salsa::database(SemanticDatabase, DefsDatabase, ParserDatabase, SyntaxDatabase, FilesDatabase)]
#[allow(missing_debug_implementations)]
pub struct DojoSemanticDatabase {
storage: salsa::Storage<DojoSemanticDatabase>,
}
Expand Down Expand Up @@ -106,6 +107,7 @@ impl Upcast<dyn ParserGroup> for DojoSemanticDatabase {
}
}

#[derive(Debug)]
pub struct WithStringDiagnostics<T> {
value: T,
diagnostics: String,
Expand All @@ -129,6 +131,7 @@ impl<T> WithStringDiagnostics<T> {
}

/// Helper struct for the return value of [setup_test_module].
#[derive(Debug)]
pub struct TestModule {
pub crate_id: CrateId,
pub module_id: ModuleId,
Expand Down Expand Up @@ -172,6 +175,7 @@ pub fn setup_test_module(
}

/// Helper struct for the return value of [setup_test_function].
#[derive(Debug)]
pub struct TestFunction {
pub module_id: ModuleId,
pub function_id: FunctionWithBodyId,
Expand Down Expand Up @@ -219,6 +223,7 @@ pub fn setup_test_function(
}

/// Helper struct for the return value of [setup_test_expr] and [setup_test_block].
#[derive(Debug)]
pub struct TestExpr {
pub module_id: ModuleId,
pub function_id: FunctionWithBodyId,
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-test-utils/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use serde_json::Value;
use starknet::providers::jsonrpc::{JsonRpcMethod, JsonRpcResponse, JsonRpcTransport};
use thiserror::Error;

#[derive(Debug)]
pub struct MockJsonRpcTransport {
responses: HashMap<(String, String), String>,
}
Expand Down
2 changes: 2 additions & 0 deletions crates/dojo-test-utils/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ use starknet::providers::JsonRpcClient;
use starknet::signers::{LocalWallet, SigningKey};
use url::Url;

#[derive(Debug)]
pub struct TestAccount {
pub private_key: Felt,
pub account_address: Felt,
}

#[allow(unused)]
#[allow(missing_debug_implementations)]
pub struct TestSequencer {
url: Url,
handle: NodeHandle,
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-types/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ impl Ty {
}
}

#[derive(Debug)]
pub struct TyIter<'a> {
stack: Vec<&'a Ty>,
}
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-world/src/contracts/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub trait ModelReader<E> {
async fn layout(&self) -> Result<abigen::model::Layout, E>;
}

#[derive(Debug)]
pub struct ModelRPCReader<'a, P: Provider + Sync + Send> {
/// Namespace of the model
namespace: String,
Expand Down
1 change: 1 addition & 0 deletions crates/dojo-world/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub enum TransactionWaitingError {
/// let receipt = TransactionWaiter::new(tx_hash, &provider).with_tx_status(TransactionFinalityStatus::AcceptedOnL2).await.unwrap();
/// ```
#[must_use = "TransactionWaiter does nothing unless polled"]
#[allow(missing_debug_implementations)]
pub struct TransactionWaiter<'a, P: Provider> {
/// The hash of the transaction to wait for.
tx_hash: Felt,
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/backend/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use katana_primitives::class::DeprecatedCompiledClass;
use starknet::core::types::FlattenedSierraClass;

#[derive(Debug)]
pub enum StarknetContract {
Legacy(DeprecatedCompiledClass),
Sierra(FlattenedSierraClass),
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use crate::utils::get_current_timestamp;

pub(crate) const LOG_TARGET: &str = "katana::core::backend";

#[derive(Debug)]
pub struct Backend<EF: ExecutorFactory> {
/// The config used to generate the backend.
pub config: StarknetConfig,
Expand Down
3 changes: 3 additions & 0 deletions crates/katana/core/src/backend/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub trait Database:
+ 'static
+ Send
+ Sync
+ core::fmt::Debug
{
}

Expand All @@ -54,9 +55,11 @@ impl<T> Database for T where
+ 'static
+ Send
+ Sync
+ core::fmt::Debug
{
}

#[derive(Debug)]
pub struct Blockchain {
inner: BlockchainProvider<Box<dyn Database>>,
}
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct SequencerConfig {
pub messaging: Option<MessagingConfig>,
}

#[allow(missing_debug_implementations)]
pub struct KatanaSequencer<EF: ExecutorFactory> {
pub config: SequencerConfig,
pub pool: Arc<TransactionPool>,
Expand Down
7 changes: 6 additions & 1 deletion crates/katana/core/src/service/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type BlockProductionWithTxnsFuture =

/// The type which responsible for block production.
#[must_use = "BlockProducer does nothing unless polled"]
#[allow(missing_debug_implementations)]
pub struct BlockProducer<EF: ExecutorFactory> {
/// The inner mode of mining.
pub inner: RwLock<BlockProducerMode<EF>>,
Expand Down Expand Up @@ -149,12 +150,14 @@ impl<EF: ExecutorFactory> BlockProducer<EF> {
/// block producer will execute all the transactions in the mempool and mine a new block with the
/// resulting state. The block context is only updated every time a new block is mined as opposed to
/// updating it when the block is opened (in _interval_ mode).

#[allow(missing_debug_implementations)]
pub enum BlockProducerMode<EF: ExecutorFactory> {
Interval(IntervalBlockProducer<EF>),
Instant(InstantBlockProducer<EF>),
}

#[derive(Clone, derive_more::Deref)]
#[derive(Debug, Clone, derive_more::Deref)]
pub struct PendingExecutor(#[deref] Arc<RwLock<Box<dyn BlockExecutor<'static>>>>);

impl PendingExecutor {
Expand All @@ -163,6 +166,7 @@ impl PendingExecutor {
}
}

#[allow(missing_debug_implementations)]
pub struct IntervalBlockProducer<EF: ExecutorFactory> {
/// The interval at which new blocks are mined.
interval: Option<Interval>,
Expand Down Expand Up @@ -442,6 +446,7 @@ impl<EF: ExecutorFactory> Stream for IntervalBlockProducer<EF> {
}
}

#[allow(missing_debug_implementations)]
pub struct InstantBlockProducer<EF: ExecutorFactory> {
/// Holds the backend if no block is being mined
backend: Arc<Backend<EF>>,
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/service/messaging/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ sol! {
}
}

#[derive(Debug)]
pub struct EthereumMessaging {
provider: Arc<ReqwestProvider<Ethereum>>,
messaging_contract_address: Address,
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/service/messaging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub trait Messenger {
) -> MessengerResult<Vec<Self::MessageHash>>;
}

#[derive(Debug)]
pub enum MessengerMode {
Ethereum(EthereumMessaging),
#[cfg(feature = "starknet-messaging")]
Expand Down
2 changes: 2 additions & 0 deletions crates/katana/core/src/service/messaging/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type MessagingFuture<T> = Pin<Box<dyn Future<Output = T> + Send>>;
type MessageGatheringFuture = MessagingFuture<MessengerResult<(u64, usize)>>;
type MessageSettlingFuture = MessagingFuture<MessengerResult<Option<(u64, usize)>>>;

#[allow(missing_debug_implementations)]
pub struct MessagingService<EF: ExecutorFactory> {
/// The interval at which the service will perform the messaging operations.
interval: Interval,
Expand Down Expand Up @@ -151,6 +152,7 @@ impl<EF: ExecutorFactory> MessagingService<EF> {
}
}

#[derive(Debug)]
pub enum MessagingOutcome {
Gather {
/// The latest block number of the settlement chain from which messages were gathered.
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/service/messaging/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const EXE_MAGIC: Felt = felt!("0x455845");

pub const HASH_EXEC: Felt = felt!("0xee");

#[derive(Debug)]
pub struct StarknetMessaging {
chain_id: Felt,
provider: AnyProvider,
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/src/service/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use dojo_metrics::Metrics;
use metrics::Counter;

#[derive(Debug)]
pub(crate) struct ServiceMetrics {
pub(crate) block_producer: BlockProducerMetrics,
}
Expand Down
2 changes: 2 additions & 0 deletions crates/katana/core/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub(crate) const LOG_TARGET: &str = "node";
/// This service is basically an endless future that continuously polls the miner which returns
/// transactions for the next block, then those transactions are handed off to the [BlockProducer]
/// to construct a new block.
#[allow(missing_debug_implementations)]
pub struct NodeService<EF: ExecutorFactory> {
/// the pool that holds all transactions
pub(crate) pool: Arc<TransactionPool>,
Expand Down Expand Up @@ -120,6 +121,7 @@ impl<EF: ExecutorFactory> Future for NodeService<EF> {
}

/// The type which takes the transaction from the pool and feeds them to the block producer.
#[derive(Debug)]
pub struct TransactionMiner {
/// stores whether there are pending transacions (if known)
has_pending_txs: Option<bool>,
Expand Down
4 changes: 2 additions & 2 deletions crates/katana/executor/src/abstraction/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
};

/// A type that can create [BlockExecutor] instance.
pub trait ExecutorFactory: Send + Sync + 'static {
pub trait ExecutorFactory: Send + Sync + 'static + core::fmt::Debug {
/// Construct a new [BlockExecutor] with the given state.
fn with_state<'a, P>(&self, state: P) -> Box<dyn BlockExecutor<'a> + 'a>
where
Expand All @@ -31,7 +31,7 @@ pub trait ExecutorFactory: Send + Sync + 'static {
}

/// An executor that can execute a block of transactions.
pub trait BlockExecutor<'a>: ExecutorExt + Send + Sync {
pub trait BlockExecutor<'a>: ExecutorExt + Send + Sync + core::fmt::Debug {
/// Executes the given block.
fn execute_block(&mut self, block: ExecutableBlock) -> ExecutorResult<()>;

Expand Down
1 change: 1 addition & 0 deletions crates/katana/executor/src/abstraction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ pub struct ResultAndStates {

/// A wrapper around a boxed [StateProvider] for implementing the executor's own state reader
/// traits.
#[derive(Debug)]
pub struct StateProviderDb<'a>(pub(crate) Box<dyn StateProvider + 'a>);

impl From<Box<dyn StateProvider>> for StateProviderDb<'_> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl ExecutorFactory for BlockifierFactory {
}
}

#[derive(Debug)]
pub struct StarknetVMProcessor<'a> {
block_context: BlockContext,
state: CachedState<StateProviderDb<'a>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl<'a> StateReader for StateProviderDb<'a> {
}
}

#[derive(Debug)]
pub(super) struct CachedState<S: StateDb>(pub(super) Arc<RwLock<CachedStateInner<S>>>);

impl<S: StateDb> Clone for CachedState<S> {
Expand Down
1 change: 1 addition & 0 deletions crates/katana/executor/src/implementation/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl<'a> BlockExecutor<'a> for NoopExecutor {
}
}

#[derive(Debug)]
struct NoopStateProvider;

impl ContractClassProvider for NoopStateProvider {
Expand Down
1 change: 1 addition & 0 deletions crates/katana/executor/src/implementation/sir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl ExecutorFactory for NativeExecutorFactory {
}
}

#[derive(Debug)]
pub struct StarknetVMProcessor<'a> {
block_context: BlockContext,
state: CachedState<StateProviderDb<'a>, PermanentContractClassCache>,
Expand Down
Loading
Loading