From 1c787730fac3d4f130c47d015b242c6a79b99d5b Mon Sep 17 00:00:00 2001 From: Leo Lu Date: Tue, 14 Mar 2023 20:21:57 +0800 Subject: [PATCH 1/2] Change language to rust to let pre-commit bootstrap rust Add an empty cargo.toml to fool the build system --- .gitignore | 1 + .pre-commit-hooks.yaml | 6 +++--- Cargo.toml | 8 ++++++++ src/main.rs | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 0ffe38d..4239d04 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -2,21 +2,21 @@ name: fmt description: Format files with cargo fmt. entry: cargo fmt - language: system + language: rust types: [rust] args: ["--"] - id: cargo-check name: cargo check description: Check the package for errors. entry: cargo check - language: system + language: rust types: [rust] pass_filenames: false - id: clippy name: clippy description: Lint rust sources entry: cargo clippy - language: system + language: rust args: ["--", "-D", "warnings"] types: [rust] pass_filenames: false diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..14caf07 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "pre-commit-rust" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} From 3a8de64acc969112746489e5ec1f0b13e00d871e Mon Sep 17 00:00:00 2001 From: Leo Lu Date: Tue, 14 Mar 2023 20:32:49 +0800 Subject: [PATCH 2/2] Add description --- Cargo.toml | 1 + src/main.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 14caf07..1740ab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "pre-commit-rust" version = "0.1.0" edition = "2021" +description = "Dummy cargo repo to ask pre-commit install cargo." # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index e7a11a9..9f11e8d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,3 @@ fn main() { - println!("Hello, world!"); + println!("This is only a placeholder."); }