difftreelog
style fix clippy warnings
in: master
8 files changed
crates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth1use std::{1use std::{any::Any, num::NonZeroU32};2 any::Any,3 num::{NonZeroU32, NonZeroUsize},4};526use jrsonnet_gcmodule::{Cc, Trace};3use jrsonnet_gcmodule::{Cc, Trace};crates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterbothno syntactic changes
crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth2 cell::RefCell,2 cell::RefCell,3 fmt::{self, Debug, Display},3 fmt::{self, Debug, Display},4 mem::replace,4 mem::replace,5 num::{NonZeroU32, NonZeroUsize},5 num::NonZeroU32,6 rc::Rc,6 rc::Rc,7};7};88crates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth218 item: proc_macro::TokenStream,218 item: proc_macro::TokenStream,219) -> proc_macro::TokenStream {219) -> proc_macro::TokenStream {220 let attr = parse_macro_input!(attr as BuiltinAttrs);220 let attr = parse_macro_input!(attr as BuiltinAttrs);221 let item_fn = item.clone();222 let item_fn: ItemFn = parse_macro_input!(item_fn);221 let item_fn = parse_macro_input!(item as ItemFn);223222224 match builtin_inner(attr, item_fn) {223 match builtin_inner(attr, item_fn) {225 Ok(v) => v.into(),224 Ok(v) => v.into(),crates/jrsonnet-stdlib/src/manifest/toml.rsdiffbeforeafterboth4 bail,4 bail,5 manifest::{escape_string_json_buf, ManifestFormat},5 manifest::{escape_string_json_buf, ManifestFormat},6 val::ArrValue,6 val::ArrValue,7 IStr, ObjValue, Result, ResultExt, Val, State,7 IStr, ObjValue, Result, ResultExt, State, Val,8};8};9910pub struct TomlFormat<'s> {10pub struct TomlFormat<'s> {crates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth1use jrsonnet_evaluator::{1use jrsonnet_evaluator::{2 bail,2 bail,3 manifest::{ManifestFormat, ToStringFormat},3 manifest::{ManifestFormat, ToStringFormat},4 typed::{ComplexValType, Either2, Either4, Typed, ValType},4 typed::{ComplexValType, Either2, Typed, ValType},5 val::{ArrValue, IndexableVal},5 val::ArrValue,6 Either, ObjValue, Result, ResultExt, Val, State,6 Either, ObjValue, Result, ResultExt, State, Val,7};7};889pub struct XmlJsonmlFormat {9pub struct XmlJsonmlFormat {393940 fn from_untyped(untyped: Val) -> Result<Self> {40 fn from_untyped(untyped: Val) -> Result<Self> {41 let val = <Either![ArrValue, String]>::from_untyped(untyped)41 let val = <Either![ArrValue, String]>::from_untyped(untyped)42 .with_description(|| format!("parsing JSONML value (an array or string)"))?;42 .description("parsing JSONML value (an array or string)")?;43 let arr = match val {43 let arr = match val {44 Either2::A(a) => a,44 Either2::A(a) => a,45 Either2::B(s) => return Ok(Self::String(s)),45 Either2::B(s) => return Ok(Self::String(s)),46 };46 };47 if arr.len() < 1 {47 if arr.is_empty() {48 bail!("JSONML value should have tag (array length should be >=1)");48 bail!("JSONML value should have tag (array length should be >=1)");49 };49 };50 let tag = String::from_untyped(50 let tag = String::from_untyped(51 arr.get(0)51 arr.get(0)52 .with_description(|| "getting JSONML tag")?52 .description("getting JSONML tag")?53 .expect("length checked"),53 .expect("length checked"),54 )54 )55 .with_description(|| format!("parsing JSONML tag"))?;55 .description("parsing JSONML tag")?;565657 let (has_attrs, attrs) = if arr.len() >= 2 {57 let (has_attrs, attrs) = if arr.len() >= 2 {58 let maybe_attrs = arr58 let maybe_attrs = arr71 tag,71 tag,72 attrs,72 attrs,73 children: State::push_description(73 children: State::push_description(74 || format!("parsing children"),74 || "parsing children".to_owned(),75 || {75 || {76 Typed::from_untyped(Val::Arr(arr.slice(76 Typed::from_untyped(Val::Arr(arr.slice(77 Some(if has_attrs { 2 } else { 1 }),77 Some(if has_attrs { 2 } else { 1 }),100 } => {100 } => {101 let has_children = !children.is_empty();101 let has_children = !children.is_empty();102 buf.push('<');102 buf.push('<');103 buf.push_str(&tag);103 buf.push_str(tag);104 attrs.run_assertions()?;104 attrs.run_assertions()?;105 for (key, value) in attrs.iter(105 for (key, value) in attrs.iter(106 // Not much sense to preserve order here106 // Not much sense to preserve order here125 }125 }126 buf.push('>');126 buf.push('>');127 for child in children {127 for child in children {128 manifest_jsonml(&child, buf, opts)?;128 manifest_jsonml(child, buf, opts)?;129 }129 }130 if has_children || opts.force_closing {130 if has_children || opts.force_closing {131 buf.push('<');131 buf.push('<');132 buf.push('/');132 buf.push('/');133 buf.push_str(&tag);133 buf.push_str(tag);134 buf.push('>');134 buf.push('>');135 }135 }136 Ok(())136 Ok(())177 }177 }178 if !found {178 if !found {179 // No match - no escapes required179 // No match - no escapes required180 out.push_str(&str);180 out.push_str(str);181 return;181 return;182 }182 }183 out.push_str(&remaining);183 out.push_str(remaining);184}184}185185crates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterbothno syntactic changes
crates/jrsonnet-stdlib/src/objects.rsdiffbeforeafterbothno syntactic changes