From 979e46e6f6c98e3fe57cfa719db93bc2ff3348da Mon Sep 17 00:00:00 2001 From: Lewis Date: Wed, 27 May 2026 11:17:44 +0100 Subject: [PATCH] housekeeping: pre-work for rust projects Lewis: May this revision serve well! --- .dockerignore | 1 + .editorconfig | 4 ++++ .gitignore | 2 ++ Cargo.toml | 42 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 6 ++++++ rust-toolchain.toml | 5 +++++ 6 files changed, 60 insertions(+) create mode 100644 Cargo.toml create mode 100644 rust-toolchain.toml diff --git a/.dockerignore b/.dockerignore index 48d02294..38c51219 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,6 +16,7 @@ appview/pages/static/x sites/target sites/.wrangler +target result result-* diff --git a/.editorconfig b/.editorconfig index e7858081..f3847b53 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,3 +14,7 @@ indent_size = 2 [*.yml] indent_size = 2 + +[*.rs] +indent_style = space +indent_size = 4 diff --git a/.gitignore b/.gitignore index 67e699ea..d56aed1d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ patches **/*.bleve sites/target/ sites/.wrangler/ +/target +**/src/_lex/ # Created if following hacking.md genjwks.out /nix/vm-data diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..2d2cf243 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,42 @@ +[workspace] +resolver = "2" +members = [] +exclude = ["sites"] + +[workspace.package] +edition = "2024" +rust-version = "1.95" +license = "MIT" +authors = [ + "Lewis ", + "Seongmin Lee ", + "oppiliappan ", + "Anirudh Oppiliappan ", + "eti ", +] + +[workspace.lints.rust] +unsafe_code = "forbid" +unused_must_use = "deny" + +[workspace.lints.clippy] +dbg_macro = "warn" +todo = "warn" +print_stdout = "deny" +print_stderr = "warn" + +[profile.release] +lto = "fat" +strip = true +codegen-units = 1 +panic = "abort" + +[profile.bench] +debug = 1 +strip = false + +[profile.profiling] +inherits = "release" +debug = 1 +strip = false +lto = "thin" diff --git a/flake.nix b/flake.nix index 689b2513..361fd811 100644 --- a/flake.nix +++ b/flake.nix @@ -164,6 +164,12 @@ includes = ["*.go"]; }; + rustfmt = { + command = pkgs.lib.getExe' fenix.packages.${system}.stable.rustfmt "rustfmt"; + options = ["--edition" "2024"]; + includes = ["*.rs"]; + }; + # prettier = let # wrapper = pkgs.runCommandLocal "prettier-wrapper" {nativeBuildInputs = [pkgs.makeWrapper];} '' # makeWrapper ${pkgs.prettier}/bin/prettier "$out" --add-flags "--plugin=${pkgs.prettier-plugin-go-template}/lib/node_modules/prettier-plugin-go-template/lib/index.js" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..f85d0487 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "1.95.0" +components = ["rustfmt", "clippy"] +targets = ["wasm32-unknown-unknown"] +profile = "minimal" -- 2.51.2