difftreelog
style fix clippy warnings
in: master
11 files changed
crates/jrsonnet-evaluator/src/dynamic.rsdiffbeforeafterboth22 self.022 self.023 .set(value)23 .set(value)24 .map_err(|_| ())24 .map_err(|_| ())25 .expect("wrapper is filled already")25 .expect("wrapper is filled already");26 }26 }27}27}28impl<T: Clone + Trace + 'static> Pending<T> {28impl<T: Clone + Trace + 'static> Pending<T> {53 }53 }54}54}555556impl<T: Trace + Clone> Into<Thunk<T>> for Pending<T> {56impl<T: Trace + Clone> From<Pending<T>> for Thunk<T> {57 fn into(self) -> Thunk<T> {57 fn from(value: Pending<T>) -> Self {58 Thunk::new(self)58 Self::new(value)59 }59 }60}60}6161crates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth294 // We have single context for all fields, so we can cache binds294 // We have single context for all fields, so we can cache binds295 let uctx = CachedUnbound::new(evaluate_object_locals(fctx.clone(), locals));295 let uctx = CachedUnbound::new(evaluate_object_locals(fctx.clone(), locals));296296297 for member in members.iter() {297 for member in members {298 match member {298 match member {299 Member::Field(field) => {299 Member::Field(field) => {300 evaluate_field_member(&mut builder, ctx.clone(), uctx.clone(), field)?;300 evaluate_field_member(&mut builder, ctx.clone(), uctx.clone(), field)?;crates/jrsonnet-evaluator/src/function/arglike.rsdiffbeforeafterboth210 tailstrict: bool,210 tailstrict: bool,211 handler: &mut dyn FnMut(&IStr, Thunk<Val>) -> Result<()>,211 handler: &mut dyn FnMut(&IStr, Thunk<Val>) -> Result<()>,212 ) -> Result<()> {212 ) -> Result<()> {213 for (name, value) in self.iter() {213 for (name, value) in self {214 handler(name, value.evaluate_arg(ctx.clone(), tailstrict)?)?;214 handler(name, value.evaluate_arg(ctx.clone(), tailstrict)?)?;215 }215 }216 Ok(())216 Ok(())217 }217 }218218219 fn named_names(&self, handler: &mut dyn FnMut(&IStr)) {219 fn named_names(&self, handler: &mut dyn FnMut(&IStr)) {220 for (name, _) in self.iter() {220 for (name, _) in self {221 handler(name);221 handler(name);222 }222 }223 }223 }crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth39 clippy::type_repetition_in_bounds,39 clippy::type_repetition_in_bounds,40 // ci is being run with nightly, but library should work on stable40 // ci is being run with nightly, but library should work on stable41 clippy::missing_const_for_fn,41 clippy::missing_const_for_fn,42 // too many false-positives with .expect() calls43 clippy::missing_panics_doc,42)]44)]434544// For jrsonnet-macros46// For jrsonnet-macroscrates/jrsonnet-evaluator/src/map.rsdiffbeforeafterboth151516impl LayeredHashMap {16impl LayeredHashMap {17 pub fn iter_keys(self, mut handler: impl FnMut(IStr)) {17 pub fn iter_keys(self, mut handler: impl FnMut(IStr)) {18 for (k, _) in self.0.current.iter() {18 for (k, _) in &*self.0.current {19 handler(k.clone());19 handler(k.clone());20 }20 }21 if let Some(parent) = self.0.parent.clone() {21 if let Some(parent) = self.0.parent.clone() {crates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth206 },206 },207 Self::ObjectRef(elems) => match value {207 Self::ObjectRef(elems) => match value {208 Val::Obj(obj) => {208 Val::Obj(obj) => {209 for (k, v) in elems.iter() {209 for (k, v) in *elems {210 if let Some(got_v) = obj.get((*k).into())? {210 if let Some(got_v) = obj.get((*k).into())? {211 push_type_description(211 push_type_description(212 || format!("property {k}"),212 || format!("property {k}"),225 },225 },226 Self::Union(types) => {226 Self::Union(types) => {227 let mut errors = Vec::new();227 let mut errors = Vec::new();228 for ty in types.iter() {228 for ty in types {229 match ty.check(value) {229 match ty.check(value) {230 Ok(()) => {230 Ok(()) => {231 return Ok(());231 return Ok(());240 }240 }241 Self::UnionRef(types) => {241 Self::UnionRef(types) => {242 let mut errors = Vec::new();242 let mut errors = Vec::new();243 for ty in types.iter() {243 for ty in *types {244 match ty.check(value) {244 match ty.check(value) {245 Ok(()) => {245 Ok(()) => {246 return Ok(());246 return Ok(());254 Err(TypeError::UnionFailed(self.clone(), TypeLocErrorList(errors)).into())254 Err(TypeError::UnionFailed(self.clone(), TypeLocErrorList(errors)).into())255 }255 }256 Self::Sum(types) => {256 Self::Sum(types) => {257 for ty in types.iter() {257 for ty in types {258 ty.check(value)?;258 ty.check(value)?;259 }259 }260 Ok(())260 Ok(())261 }261 }262 Self::SumRef(types) => {262 Self::SumRef(types) => {263 for ty in types.iter() {263 for ty in *types {264 ty.check(value)?;264 ty.check(value)?;265 }265 }266 Ok(())266 Ok(())crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth346impl Eq for StrValue {}346impl Eq for StrValue {}347impl PartialOrd for StrValue {347impl PartialOrd for StrValue {348 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {348 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {349 let a = self.clone().into_flat();350 let b = other.clone().into_flat();351 Some(a.cmp(&b))349 Some(self.cmp(other))352 }350 }353}351}354impl Ord for StrValue {352impl Ord for StrValue {355 fn cmp(&self, other: &Self) -> std::cmp::Ordering {353 fn cmp(&self, other: &Self) -> std::cmp::Ordering {356 self.partial_cmp(other)354 let a = self.clone().into_flat();357 .expect("partial_cmp always returns Some")355 let b = other.clone().into_flat();356 a.cmp(&b)358 }357 }359}358}360359crates/jrsonnet-interner/src/inner.rsdiffbeforeafterboth217impl Eq for Inner {}217impl Eq for Inner {}218impl PartialOrd for Inner {218impl PartialOrd for Inner {219 fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {219 fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {220 self.as_slice().partial_cmp(other.as_slice())220 Some(self.cmp(other))221 }221 }222}222}223impl Ord for Inner {223impl Ord for Inner {crates/jrsonnet-macros/src/lib.rsdiffbeforeafterbothno syntactic changes
crates/jrsonnet-stdlib/src/sort.rsdiffbeforeafterboth26struct NonNaNf64(f64);26struct NonNaNf64(f64);27impl PartialOrd for NonNaNf64 {27impl PartialOrd for NonNaNf64 {28 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {28 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {29 self.0.partial_cmp(&other.0)29 Some(self.cmp(other))30 }30 }31}31}32impl Eq for NonNaNf64 {}32impl Eq for NonNaNf64 {}33impl Ord for NonNaNf64 {33impl Ord for NonNaNf64 {34 fn cmp(&self, other: &Self) -> std::cmp::Ordering {34 fn cmp(&self, other: &Self) -> std::cmp::Ordering {35 self.partial_cmp(other).expect("non nan")35 self.0.partial_cmp(&other.0).expect("non nan")36 }36 }37}37}3838flake.nixdiffbeforeafterboth17 overlays = [ rust-overlay.overlays.default ];17 overlays = [ rust-overlay.overlays.default ];18 };18 };19 rust = ((pkgs.rustChannelOf { date = "2023-07-23"; channel = "nightly"; }).default.override {19 rust = ((pkgs.rustChannelOf { date = "2023-07-23"; channel = "nightly"; }).default.override {20 extensions = [ "rust-src" "miri" "rust-analyzer" ];20 extensions = [ "rust-src" "miri" "rust-analyzer" "clippy" ];21 });21 });22 in22 in23 rec {23 rec {