From b07eb248f14e768667212dda4a7b96bb57327dd0 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Mon, 20 Nov 2023 12:59:32 +0100 Subject: [PATCH] formatting things and pre commit hooks --- .gitignore | 1 + flake.nix | 20 +++++++++++++------- src/error/mod.rs | 2 -- src/namespace/typedef.rs | 4 +++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index dd461a6..fcaa00f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .devenv/ .direnv/ /target +.pre-commit-config.yaml diff --git a/flake.nix b/flake.nix index 6aaf749..c8148c6 100644 --- a/flake.nix +++ b/flake.nix @@ -25,13 +25,19 @@ default = devenv.lib.mkShell { inherit inputs pkgs; modules = [ - ({pkgs, config, ...}: { - languages.rust = { - enable = true; - channel = "nightly"; - }; - packages = []; - }) + ({pkgs, config, ...}: { + languages.rust = { + enable = true; + channel = "nightly"; + }; + + pre-commit.hooks = { + clippy.enable = true; + rustfmt.enable = true; + }; + + packages = []; + }) ]; }; }); diff --git a/src/error/mod.rs b/src/error/mod.rs index 8a04587..4f15d36 100644 --- a/src/error/mod.rs +++ b/src/error/mod.rs @@ -1,5 +1,3 @@ - - use codespan_reporting::{ diagnostic::{Diagnostic, Label}, files::SimpleFiles, diff --git a/src/namespace/typedef.rs b/src/namespace/typedef.rs index 0bb305e..191e447 100644 --- a/src/namespace/typedef.rs +++ b/src/namespace/typedef.rs @@ -112,7 +112,9 @@ impl From> for InternalTypeDef { match value { TypeDef::Type(val) => Self::Single(TypeNamespaceId::Types(val.id)), TypeDef::Trait(val) => Self::Single(TypeNamespaceId::Traits(val.id)), - TypeDef::List(list) => Self::List(list.into_iter().map(std::convert::Into::into).collect()), + TypeDef::List(list) => { + Self::List(list.into_iter().map(std::convert::Into::into).collect()) + } TypeDef::Record(rec) => Self::Record( rec.into_iter() .map(|(name, typ)| (name, typ.into()))