-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updates to parser #56
Conversation
wow, great work! diff --git a/derive/src/parse.rs b/derive/src/parse.rs
index 42de5d2..67d8575 100644
--- a/derive/src/parse.rs
+++ b/derive/src/parse.rs
@@ -14,14 +14,14 @@ use alloc::{format, vec};
use proc_macro::{Delimiter, Group, TokenStream, TokenTree};
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub struct Attribute {
pub name: String,
pub tokens: Vec<String>,
}
#[allow(dead_code)]
-#[derive(Debug, Copy, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Copy, Clone)]
pub enum Visibility {
Public,
Crate,
@@ -29,12 +29,12 @@ pub enum Visibility {
Private,
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub struct Lifetime {
pub(crate) ident: String,
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub struct Field {
pub attributes: Vec<Attribute>,
pub vis: Visibility,
@@ -42,19 +42,19 @@ pub struct Field {
pub ty: Type,
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub enum ConstValType {
Value(isize),
Named(Box<Type>),
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub enum FnType {
Bare,
Closure { reusable: bool, fn_mut: bool },
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub enum Category {
Never,
None,
@@ -96,7 +96,7 @@ pub enum Category {
}
#[allow(dead_code)]
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub struct Type {
pub ident: Category,
pub wraps: Option<Vec<Type>>,
@@ -104,7 +104,7 @@ pub struct Type {
pub as_other: Option<Box<Type>>,
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub enum Generic {
ConstGeneric {
name: String,
@@ -126,7 +126,7 @@ pub enum Generic {
},
}
-#[derive(Debug, Clone, PartialEq, Hash, Eq)]
+#[derive(Debug, Clone)]
pub struct Struct {
pub name: Option<String>,
pub named: bool,
@@ -1481,25 +1481,13 @@ fn get_all_bounds<T: Iterator<Item = TokenTree> + Clone>(source: &mut Peekable<T
for gen in ret.iter_mut() {
match gen {
Generic::Generic { bounds, .. } => {
- *bounds = std::mem::take(bounds)
- .into_iter()
- .collect::<HashSet<_>>()
- .into_iter()
- .collect()
+ *bounds = std::mem::take(bounds);
}
Generic::Lifetime { bounds, .. } => {
- *bounds = std::mem::take(bounds)
- .into_iter()
- .collect::<HashSet<_>>()
- .into_iter()
- .collect()
+ *bounds = std::mem::take(bounds);
}
Generic::WhereBounded { bounds, .. } => {
- *bounds = std::mem::take(bounds)
- .into_iter()
- .collect::<HashSet<_>>()
- .into_iter()
- .collect()
+ *bounds = std::mem::take(bounds);
}
_ => (),
} <- is this Also this |
You're correct, those were not needed so far as I can tell. |
got it. So maybe we can avoid that |
@not-fl3 I was able to remove that bit also, it was indeed leftover |
Fixes many issues related to generics