From 79406705d8463cdb1a526678552ae05efbdf2fcc Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Fri, 29 May 2026 15:22:47 +0200 Subject: [PATCH] Improve Makefile and pint Rust to version `1.89.0` --- Cargo.toml | 2 +- Makefile | 16 ++++++++++++++-- README.md | 13 +++++++++---- crates/README.md | 8 ++------ crates/geomerge-demo/README.md | 2 +- crates/geomerge-demo/src/main.rs | 1 + flake.nix | 2 +- rust-toolchain.toml | 2 +- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 12a24d8..33cbea4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "3" [workspace.package] edition = "2024" license = "MIT OR Apache-2.0" -rust-version = "1.85.0" +rust-version = "1.89.0" [workspace.lints.rust] unsafe_code = "forbid" diff --git a/Makefile b/Makefile index 86ff83d..47ee724 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,12 @@ HAS_CARGO := $(wildcard Cargo.toml) +# Workspace crates discovered under `crates/*/Cargo.toml`. The directory name is +# assumed to match the package name (the convention documented in crates/README.md). +CRATE_MANIFESTS := $(wildcard crates/*/Cargo.toml) +CRATES := $(patsubst crates/%/Cargo.toml,%,$(CRATE_MANIFESTS)) +CRATE_FLAGS := $(addprefix -p ,$(CRATES)) + .DEFAULT_GOAL := help .PHONY: help @@ -26,11 +32,13 @@ format-check: ## Check code formatting without applying changes fi .PHONY: lint -lint: ## Run linters across all targets and features +lint: ## Run linters across every crate under crates/ @if [ -z "$(HAS_CARGO)" ]; then \ echo "No Cargo.toml found. Skipping lint."; \ + elif [ -z "$(CRATES)" ]; then \ + echo "No crates/*/Cargo.toml found. Skipping lint."; \ else \ - cargo clippy --all-targets --all-features -- -D warnings; \ + cargo clippy $(CRATE_FLAGS) --no-deps -- -D warnings -D clippy::unwrap_used -D clippy::expect_used; \ fi .PHONY: test @@ -52,6 +60,10 @@ clean: ## Remove build output cargo clean; \ fi +.PHONY: shell +shell: ## Enter the Nix dev shell defined in flake.nix + @nix develop + .PHONY: setup-hooks setup-hooks: ## Install Git hooks with pre-commit @pre-commit install --hook-type pre-commit diff --git a/README.md b/README.md index 7f1edc4..28e7520 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,21 @@ This repo is a playground for running small experiments related to things like F ### Development ```sh +# Clone the repo with submodules +git clone --recursive git@code.obsidian.systems:habedi-work/storage-engine-playground.git +``` + +```sh +# Enter the development environment nix develop ``` #### Makefile Targets ```sh -make format -make lint -make test -make check +make format # Format Rust code +make lint # Run linter checks +make test # Run tests ``` Run `make help` to see all the available targets. diff --git a/crates/README.md b/crates/README.md index bab6d4d..fd57dda 100644 --- a/crates/README.md +++ b/crates/README.md @@ -1,11 +1,7 @@ ## Crates -Independent Rust app crates live in this directory. - -Each subdirectory should be a normal Cargo package with its own `Cargo.toml`. -The repository root is a virtual workspace, so shared commands such as `make format`, `make lint`, and `make test` run across all crates. - -Suggested shape: +Each subdirectory should be a normal Cargo package (or crate) with its own `Cargo.toml`. +Something like this: ```text crates/ diff --git a/crates/geomerge-demo/README.md b/crates/geomerge-demo/README.md index b7ac097..758b371 100644 --- a/crates/geomerge-demo/README.md +++ b/crates/geomerge-demo/README.md @@ -4,7 +4,7 @@ This demo shows how to store and read data from Geomerge. The demo: -1. loads the compiled `paths.json` schema, +1. loads the compiled [`paths.json`](../../external/geomerge/crates/geomerge/tests/data/paths.json) schema, 2. creates a Geomerge store, 3. inserts a small graph dataset in one transaction, 4. reads the inserted edge back, diff --git a/crates/geomerge-demo/src/main.rs b/crates/geomerge-demo/src/main.rs index 128ce77..f2cb071 100644 --- a/crates/geomerge-demo/src/main.rs +++ b/crates/geomerge-demo/src/main.rs @@ -160,6 +160,7 @@ fn row_count(store: &Store, table: &str) -> DemoResult { } #[cfg(test)] +#[allow(clippy::expect_used, clippy::unwrap_used)] mod tests { use super::{add_paths_data, load_paths_theory, row_count, run_demo}; use geomerge::{ diff --git a/flake.nix b/flake.nix index 783e2cf..416eb1f 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ }; # Pinned to match workspace.package.rust-version in Cargo.toml. - rustToolchain = pkgs.rust-bin.stable."1.85.0".default.override { + rustToolchain = pkgs.rust-bin.stable."1.89.0".default.override { extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ]; }; in diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 787a54a..8f0ca5d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.85.0" +channel = "1.89.0" components = ["rustfmt", "clippy", "rust-analyzer"]