git.delta.rocks / jrsonnet / refs/commits / ad8b59dcdf89

difftreelog

style fix rustfmt and clippy warnings

Лач2020-05-31parent: #64fb395.patch.diff
in: master

4 files changed

modifiedcrates/jsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
152 context.clone().extend(152 context.clone().extend(
153 new_bindings.clone().unwrap(),153 new_bindings.clone().unwrap(),
154 context.clone().dollar().clone().or_else(||this.clone()),154 context.clone().dollar().clone().or_else(||this.clone()),
155 Some(this.clone().unwrap()),155 Some(this.unwrap()),
156 super_obj156 super_obj
157 )157 )
158 })158 })
347 }347 }
348 ("std", "codepoint") => {348 ("std", "codepoint") => {
349 assert_eq!(args.len(), 1);349 assert_eq!(args.len(), 1);
350 if let Val::Str(s) = evaluate(context.clone(), &args[0].1) {350 if let Val::Str(s) = evaluate(context, &args[0].1) {
351 assert!(351 assert!(
352 s.chars().count() == 1,352 s.chars().count() == 1,
353 "std.codepoint should receive single char string"353 "std.codepoint should receive single char string"
modifiedcrates/jsonnet-evaluator/src/obj.rsdiffbeforeafterboth

no syntactic changes

modifiedcrates/jsonnet-parser/src/expr.rsdiffbeforeafterboth
83pub struct ParamsDesc(pub Vec<Param>);83pub struct ParamsDesc(pub Vec<Param>);
84impl ParamsDesc {84impl ParamsDesc {
85 pub fn with_defaults(&self) -> Vec<Param> {85 pub fn with_defaults(&self) -> Vec<Param> {
86 self.086 self.0.iter().filter(|e| e.1.is_some()).cloned().collect()
87 .iter()
88 .filter(|e| e.1.is_some())
89 .map(|e| e.clone())
90 .collect()
91 }87 }
92}88}
modifiedcrates/jsonnet-parser/src/lib.rsdiffbeforeafterboth
2323
24 /// For comma-delimited elements24 /// For comma-delimited elements
25 rule comma() = quiet!{_ "," _} / expected!("<comma>")25 rule comma() = quiet!{_ "," _} / expected!("<comma>")
26 rule alpha() -> char = c:$(['_' | 'a'..='z' | 'A'..='Z']) {c.chars().nth(0).unwrap()}26 rule alpha() -> char = c:$(['_' | 'a'..='z' | 'A'..='Z']) {c.chars().next().unwrap()}
27 rule digit() -> char = d:$(['0'..='9']) {d.chars().nth(0).unwrap()}27 rule digit() -> char = d:$(['0'..='9']) {d.chars().next().unwrap()}
28 rule end_of_ident() = !['0'..='9' | '_' | 'a'..='z' | 'A'..='Z']28 rule end_of_ident() = !['0'..='9' | '_' | 'a'..='z' | 'A'..='Z']
29 /// Sequence of digits29 /// Sequence of digits
30 rule uint() -> u32 = a:$(digit()+) { a.parse().unwrap() }30 rule uint() -> u32 = a:$(digit()+) { a.parse().unwrap() }
106 value,106 value,
107 post_locals,107 post_locals,
108 first,108 first,
109 rest: rest.unwrap_or(Vec::new()),109 rest: rest.unwrap_or_default(),
110 }110 }
111 }111 }
112 / members:(member() ** comma()) comma()? {expr::ObjBody::MemberList(members)}112 / members:(member() ** comma()) comma()? {expr::ObjBody::MemberList(members)}
119 pub rule parened_expr() -> Expr = "(" e:boxed_expr() ")" {Expr::Parened(e)}119 pub rule parened_expr() -> Expr = "(" e:boxed_expr() ")" {Expr::Parened(e)}
120 pub rule obj_expr() -> Expr = "{" _ body:objinside() _ "}" {Expr::Obj(body)}120 pub rule obj_expr() -> Expr = "{" _ body:objinside() _ "}" {Expr::Obj(body)}
121 pub rule array_expr() -> Expr = "[" _ elems:(expr() ** comma()) _ comma()? "]" {Expr::Arr(elems)}121 pub rule array_expr() -> Expr = "[" _ elems:(expr() ** comma()) _ comma()? "]" {Expr::Arr(elems)}
122 pub rule array_comp_expr() -> Expr = "[" _ expr:boxed_expr() _ comma()? _ forspec:forspec() _ others:(others: compspec() _ {others})? "]" {Expr::ArrComp(expr, forspec, others.unwrap_or(vec![]))}122 pub rule array_comp_expr() -> Expr = "[" _ expr:boxed_expr() _ comma()? _ forspec:forspec() _ others:(others: compspec() _ {others})? "]" {Expr::ArrComp(expr, forspec, others.unwrap_or_default())}
123 pub rule index_expr() -> Expr123 pub rule index_expr() -> Expr
124 = val:boxed_expr() "." idx:id() {Expr::Index(val, Box::new(Expr::Str(idx)))}124 = val:boxed_expr() "." idx:id() {Expr::Index(val, Box::new(Expr::Str(idx)))}
125 / val:boxed_expr() "[" key:boxed_expr() "]" {Expr::Index(val, key)}125 / val:boxed_expr() "[" key:boxed_expr() "]" {Expr::Index(val, key)}