Skip to content

Commit

Permalink
Remove enum_iterator
Browse files Browse the repository at this point in the history
It is used only in mk_enum and the macro knows already its variants so
it can be manually implemented.
  • Loading branch information
lu-zero committed Nov 26, 2021
1 parent a6fb78b commit fff0cf3
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 29 deletions.
21 changes: 0 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion enums/src/go.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use askama::Template;
use enum_iterator::IntoEnumIterator;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
Expand Down
1 change: 0 additions & 1 deletion enums/src/json.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use askama::Template;
use enum_iterator::IntoEnumIterator;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
Expand Down
1 change: 0 additions & 1 deletion enums/src/languages.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use enum_iterator::IntoEnumIterator;
use tree_sitter::Language;

use crate::*;
Expand Down
1 change: 0 additions & 1 deletion enums/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate askama;
extern crate enum_iterator;
extern crate tree_sitter;

#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion enums/src/rust.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use askama::Template;
use enum_iterator::IntoEnumIterator;
use std::env;
use std::fs::File;
use std::io::{Read, Write};
Expand Down
1 change: 0 additions & 1 deletion src/langs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use enum_iterator::IntoEnumIterator;
use std::path::Path;
use std::sync::Arc;
use tree_sitter::Language;
Expand Down
8 changes: 7 additions & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item=LANG> {
use LANG::*;
[$( $camel, )*].into_iter()
}
}
};
}

Expand Down

0 comments on commit fff0cf3

Please sign in to comment.