diff --git a/Cargo.lock b/Cargo.lock index cffe4d8e0..41cd1cfcb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -692,26 +692,6 @@ dependencies = [ "syn", ] -[[package]] -name = "enum-iterator" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "fixedbitset" version = "0.4.0" @@ -1600,7 +1580,6 @@ name = "rust-code-analysis" version = "0.0.23" dependencies = [ "aho-corasick", - "enum-iterator", "fxhash", "lazy_static", "num", diff --git a/Cargo.toml b/Cargo.toml index 9e98bc638..5282f600c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ license = "MPL-2.0" [dependencies] aho-corasick = "^0.7" -enum-iterator = "^0.7" fxhash = "0.2" lazy_static = "^1.3" num-format = "^0.4" diff --git a/enums/Cargo.toml b/enums/Cargo.toml index e004ac0bc..e53fe7201 100644 --- a/enums/Cargo.toml +++ b/enums/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Calixte Denizet "] edition = "2021" [dependencies] -enum-iterator = "^0.7" clap = "^2.33" askama = "^0.10" diff --git a/enums/src/go.rs b/enums/src/go.rs index 7f6a57762..d69d227e2 100644 --- a/enums/src/go.rs +++ b/enums/src/go.rs @@ -1,5 +1,4 @@ use askama::Template; -use enum_iterator::IntoEnumIterator; use std::fs::File; use std::io::Write; use std::path::PathBuf; diff --git a/enums/src/json.rs b/enums/src/json.rs index 906f73dc1..cf9843870 100644 --- a/enums/src/json.rs +++ b/enums/src/json.rs @@ -1,5 +1,4 @@ use askama::Template; -use enum_iterator::IntoEnumIterator; use std::fs::File; use std::io::Write; use std::path::PathBuf; diff --git a/enums/src/languages.rs b/enums/src/languages.rs index 73ed6e343..c5a105352 100644 --- a/enums/src/languages.rs +++ b/enums/src/languages.rs @@ -1,4 +1,3 @@ -use enum_iterator::IntoEnumIterator; use tree_sitter::Language; use crate::*; diff --git a/enums/src/lib.rs b/enums/src/lib.rs index 70c724164..5778236e4 100644 --- a/enums/src/lib.rs +++ b/enums/src/lib.rs @@ -1,5 +1,4 @@ extern crate askama; -extern crate enum_iterator; extern crate tree_sitter; #[macro_use] diff --git a/enums/src/macros.rs b/enums/src/macros.rs index 2842b1cba..411df942d 100644 --- a/enums/src/macros.rs +++ b/enums/src/macros.rs @@ -1,11 +1,17 @@ macro_rules! mk_enum { ( $( $camel:ident ),* ) => { - #[derive(Clone, Debug, IntoEnumIterator, PartialEq)] + #[derive(Clone, Debug, PartialEq)] pub enum Lang { $( $camel, )* } + impl Lang { + pub fn into_enum_iter() -> impl Iterator { + use Lang::*; + [$( $camel, )*].into_iter() + } + } }; } diff --git a/enums/src/rust.rs b/enums/src/rust.rs index ad13f6686..22fdd5bc0 100644 --- a/enums/src/rust.rs +++ b/enums/src/rust.rs @@ -1,5 +1,4 @@ use askama::Template; -use enum_iterator::IntoEnumIterator; use std::env; use std::fs::File; use std::io::{Read, Write}; diff --git a/src/langs.rs b/src/langs.rs index 9217bbc5c..9eb4fca82 100644 --- a/src/langs.rs +++ b/src/langs.rs @@ -1,4 +1,3 @@ -use enum_iterator::IntoEnumIterator; use std::path::Path; use std::sync::Arc; use tree_sitter::Language; diff --git a/src/macros.rs b/src/macros.rs index 6bdeecdb5..f12e517a8 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -46,13 +46,19 @@ macro_rules! get_language { macro_rules! mk_enum { ( $( $camel:ident, $description:expr ),* ) => { /// The list of supported languages. - #[derive(Clone, Copy, Debug, IntoEnumIterator, PartialEq)] + #[derive(Clone, Copy, Debug, PartialEq)] pub enum LANG { $( #[doc = $description] $camel, )* } + impl LANG { + pub fn into_enum_iter() -> impl Iterator { + use LANG::*; + [$( $camel, )*].into_iter() + } + } }; }