Skip to content

Commit 57ba17a

Browse files
authored
Reduce the size of Expression (#83)
1 parent 6d0341d commit 57ba17a

File tree

7 files changed

+4824
-2417
lines changed

7 files changed

+4824
-2417
lines changed

.cargo/config.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ rustflags = [
6262
"-Wclippy::string_add_assign",
6363
"-Wclippy::string_add",
6464
"-Wclippy::string_lit_as_bytes",
65-
"-Wclippy::string_to_string",
6665
"-Wclippy::todo",
6766
"-Wclippy::trait_duplication_in_bounds",
6867
"-Wclippy::unimplemented",

src/expression/parser.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
AdditionItem, LicenseItem, LicenseReq, ParseMode,
2+
AdditionItem, AdditionRef, LicenseItem, LicenseRef, LicenseReq, ParseMode,
33
error::{ParseError, Reason},
44
expression::{ExprNode, Expression, ExpressionReq, Operator},
55
lexer::{Lexer, Token},
@@ -225,10 +225,10 @@ impl Expression {
225225
None | Some(Token::And | Token::Or | Token::OpenParen) => {
226226
expr_queue.push(ExprNode::Req(ExpressionReq {
227227
req: LicenseReq {
228-
license: LicenseItem::Other {
228+
license: LicenseItem::Other(Box::new(LicenseRef {
229229
doc_ref: doc_ref.map(String::from),
230230
lic_ref: String::from(*lic_ref),
231-
},
231+
})),
232232
addition: None,
233233
},
234234
span: lt.span.start as u32..lt.span.end as u32,
@@ -378,10 +378,10 @@ impl Expression {
378378
Token::AdditionRef { doc_ref, add_ref } => match last_token {
379379
Some(Token::With) => match expr_queue.last_mut() {
380380
Some(ExprNode::Req(lic)) => {
381-
lic.req.addition = Some(AdditionItem::Other {
381+
lic.req.addition = Some(AdditionItem::Other(Box::new(AdditionRef {
382382
doc_ref: doc_ref.map(String::from),
383383
add_ref: String::from(*add_ref),
384-
});
384+
})));
385385
}
386386
_ => unreachable!(),
387387
},

0 commit comments

Comments
 (0)