meta: Add pre-commit configuration

This commit is contained in:
David Mak 2024-06-12 12:52:00 +08:00
parent 495b26bf70
commit 5001988e09
2 changed files with 26 additions and 4 deletions

24
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [commit]
repos:
- repo: local
hooks:
- id: nac3-cargo-fmt
name: nac3 cargo format
entry: cargo
language: system
types: [file, rust]
pass_filenames: false
description: Runs cargo fmt on the codebase.
args: [fmt]
- id: nac3-cargo-clippy
name: nac3 cargo clippy
entry: cargo
language: system
types: [file, rust]
pass_filenames: false
description: Runs cargo clippy on the codebase.
args: [clippy]

View File

@ -314,10 +314,8 @@ fn main() {
StmtKind::ImportFrom { module, names, .. }
if module == &Some("__future__".into())
&& names.len() == 1
&& names[0].name == "annotations".into() =>
{
()
}
&& names[0].name == "annotations".into() => {}
_ => {
let (name, def_id, ty) = composer
.register_top_level(stmt, Some(resolver.clone()), "__main__", true)