Skip to content

Commit f9be769

Browse files
authored
Revert "all: Fix all cargo check warnings and make cargo check mandatory (#6101)"
This reverts commit ebcde81.
1 parent ebcde81 commit f9be769

File tree

11 files changed

+17
-32
lines changed

11 files changed

+17
-32
lines changed

CLAUDE.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,12 @@ THEGRAPH_STORE_POSTGRES_DIESEL_URL="postgresql://graph:graph@127.0.0.1:5432/grap
3434
# 🚨 MANDATORY: Format all code IMMEDIATELY after any .rs file edit
3535
cargo fmt --all
3636

37-
# 🚨 MANDATORY: Check code for warnings and errors - MUST have zero warnings
37+
# Check code without building
3838
cargo check
3939
```
4040

41-
🚨 **CRITICAL REQUIREMENTS for ANY implementation**:
42-
1. **`cargo fmt --all`** is MANDATORY after editing ANY .rs file - NO EXCEPTIONS!
43-
2. **`cargo check`** MUST show zero warnings before any commit - NO EXCEPTIONS!
44-
3. **All tests** MUST pass before any commit
45-
4. All requirements must be met from the project root BEFORE any commit
46-
5. Forgetting any of these means you failed to follow instructions
41+
🚨 **CRITICAL REMINDER**: `cargo fmt --all` is MANDATORY after editing ANY .rs file - NO EXCEPTIONS!
42+
This must be done from the project root BEFORE any commit. Forgetting this means you failed to follow instructions.
4743

4844
## High-Level Architecture
4945

@@ -95,18 +91,12 @@ Use format: `{crate-name}: {description}`
9591
- Keep commits logical and atomic
9692
- Use `git rebase -i` to clean up history before merging
9793

98-
### Implementation Success Criteria
99-
Before any commit or PR, ALL of the following MUST be satisfied:
100-
101-
1. **🚨 MANDATORY**: All tests MUST pass
102-
2. **🚨 MANDATORY**: `cargo check` MUST show zero warnings
103-
3. **🚨 MANDATORY**: `cargo fmt --all` MUST be run after editing ANY .rs file
104-
105-
**Testing Notes**:
94+
### Testing Requirements
10695
- Unit tests inline with source code
107-
- Integration tests require Docker Compose setup and additional environment dependencies
96+
- Integration tests require Docker Compose setup and additional environment dependencies
10897
- Claude cannot run integration tests due to missing environment dependencies
10998
- Claude must set `THEGRAPH_STORE_POSTGRES_DIESEL_URL` before running any tests
99+
- **🚨 MANDATORY**: Always run `cargo fmt --all` after editing .rs files, BEFORE committing
110100

111101
### Environment Variables
112102
- `GRAPH_LOG=debug`: Enable debug logging

graph/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ sqlparser = { workspace = true }
6161
# stable-hash_legacy = { version = "0.3.3", package = "stable-hash" }
6262
# stable-hash = { version = "0.4.2" }
6363
stable-hash = { git = "https://github.com/graphprotocol/stable-hash", branch = "main" }
64-
stable-hash_legacy = { git = "https://github.com/graphprotocol/stable-hash", branch = "old", package = "stable-hash" }
64+
stable-hash_legacy = { git = "https://github.com/graphprotocol/stable-hash", branch = "old", package = "stable-hash", doc = false }
6565
strum_macros = "0.27.1"
6666
slog-async = "2.5.0"
6767
slog-envlogger = "2.1.0"

graph/src/components/store/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl EntityModification {
145145

146146
/// Return the details of the write if `self` is a write operation for a
147147
/// new or an existing entity
148-
fn as_write(&self) -> Option<EntityWrite<'_>> {
148+
fn as_write(&self) -> Option<EntityWrite> {
149149
EntityWrite::try_from(self).ok()
150150
}
151151

@@ -823,7 +823,7 @@ impl Batch {
823823
&self,
824824
entity_type: &EntityType,
825825
at: BlockNumber,
826-
) -> impl Iterator<Item = EntityOp<'_>> {
826+
) -> impl Iterator<Item = EntityOp> {
827827
self.mods
828828
.group(entity_type)
829829
.map(|group| group.effective_ops(at))

graph/src/components/subgraph/proof_of_indexing/reference.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@ use web3::types::{Address, H256};
99
/// well-implemented (without conflicting sequence numbers, or other oddities).
1010
/// It's just way easier to check that this works, and serves as a kind of
1111
/// documentation as a side-benefit.
12-
#[allow(dead_code)]
1312
pub struct PoI<'a> {
1413
pub causality_regions: HashMap<String, PoICausalityRegion<'a>>,
1514
pub subgraph_id: DeploymentHash,
1615
pub block_hash: H256,
1716
pub indexer: Option<Address>,
1817
}
1918

20-
#[allow(dead_code)]
2119
fn h256_as_bytes(val: &H256) -> AsBytes<&[u8]> {
2220
AsBytes(val.as_bytes())
2321
}
2422

25-
#[allow(dead_code)]
2623
fn indexer_opt_as_bytes(val: &Option<Address>) -> Option<AsBytes<&[u8]>> {
2724
val.as_ref().map(|v| AsBytes(v.as_bytes()))
2825
}

graph/src/util/timed_rw_lock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl<T> TimedRwLock<T> {
2020
}
2121
}
2222

23-
pub fn write(&self, logger: &Logger) -> parking_lot::RwLockWriteGuard<'_, T> {
23+
pub fn write(&self, logger: &Logger) -> parking_lot::RwLockWriteGuard<T> {
2424
loop {
2525
let mut elapsed = Duration::from_secs(0);
2626
match self.lock.try_write_for(self.log_threshold) {
@@ -36,11 +36,11 @@ impl<T> TimedRwLock<T> {
3636
}
3737
}
3838

39-
pub fn try_read(&self) -> Option<parking_lot::RwLockReadGuard<'_, T>> {
39+
pub fn try_read(&self) -> Option<parking_lot::RwLockReadGuard<T>> {
4040
self.lock.try_read()
4141
}
4242

43-
pub fn read(&self, logger: &Logger) -> parking_lot::RwLockReadGuard<'_, T> {
43+
pub fn read(&self, logger: &Logger) -> parking_lot::RwLockReadGuard<T> {
4444
loop {
4545
let mut elapsed = Duration::from_secs(0);
4646
match self.lock.try_read_for(self.log_threshold) {
@@ -73,7 +73,7 @@ impl<T> TimedMutex<T> {
7373
}
7474
}
7575

76-
pub fn lock(&self, logger: &Logger) -> parking_lot::MutexGuard<'_, T> {
76+
pub fn lock(&self, logger: &Logger) -> parking_lot::MutexGuard<T> {
7777
let start = Instant::now();
7878
let guard = self.lock.lock();
7979
let elapsed = start.elapsed();

runtime/wasm/src/module/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl WasmInstance {
141141
self.store.into_data()
142142
}
143143

144-
pub(crate) fn instance_ctx(&mut self) -> WasmInstanceContext<'_> {
144+
pub(crate) fn instance_ctx(&mut self) -> WasmInstanceContext {
145145
WasmInstanceContext::new(&mut self.store)
146146
}
147147

runtime/wasm/src/to_from/external.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ where
466466
}
467467

468468
#[derive(Debug, Clone, Eq, PartialEq, AscType)]
469-
#[allow(dead_code)]
470469
pub enum AscSubgraphEntityOp {
471470
Create,
472471
Modify,

store/postgres/src/relational/dsl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'a> Table<'a> {
176176
}
177177

178178
/// Reference a column in this table and use the correct SQL type `ST`
179-
fn bind<ST>(&self, name: &str) -> Option<BoundColumn<'_, ST>> {
179+
fn bind<ST>(&self, name: &str) -> Option<BoundColumn<ST>> {
180180
self.column(name).map(|c| c.bind())
181181
}
182182

store/postgres/src/relational_queries.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4976,7 +4976,6 @@ impl<'a, Conn> RunQueryDsl<Conn> for CountCurrentVersionsQuery<'a> {}
49764976
/// Helper struct for returning the id's touched by the RevertRemove and
49774977
/// RevertExtend queries
49784978
#[derive(QueryableByName, PartialEq, Eq, Hash)]
4979-
#[allow(dead_code)]
49804979
pub struct CopyVid {
49814980
#[diesel(sql_type = BigInt)]
49824981
pub vid: i64,

store/postgres/src/subgraph_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ impl SubgraphStoreInner {
789789
/// connections can deadlock the entire process if the pool runs out
790790
/// of connections in between getting the first one and trying to get the
791791
/// second one.
792-
pub(crate) fn primary_conn(&self) -> Result<primary::Connection<'_>, StoreError> {
792+
pub(crate) fn primary_conn(&self) -> Result<primary::Connection, StoreError> {
793793
let conn = self.mirror.primary().get()?;
794794
Ok(primary::Connection::new(conn))
795795
}

0 commit comments

Comments
 (0)