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

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2023-07-27parent: #5dc3b98.patch.diff
in: master

11 files changed

modifiedcrates/jrsonnet-evaluator/src/dynamic.rsdiffbeforeafterboth
22 self.022 self.0
23 .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}
5555
56impl<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}
6161
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
294 // We have single context for all fields, so we can cache binds294 // We have single context for all fields, so we can cache binds
295 let uctx = CachedUnbound::new(evaluate_object_locals(fctx.clone(), locals));295 let uctx = CachedUnbound::new(evaluate_object_locals(fctx.clone(), locals));
296296
297 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)?;
modifiedcrates/jrsonnet-evaluator/src/function/arglike.rsdiffbeforeafterboth
210 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 }
218218
219 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 }
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
39 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 stable
41 clippy::missing_const_for_fn,41 clippy::missing_const_for_fn,
42 // too many false-positives with .expect() calls
43 clippy::missing_panics_doc,
42)]44)]
4345
44// For jrsonnet-macros46// For jrsonnet-macros
modifiedcrates/jrsonnet-evaluator/src/map.rsdiffbeforeafterboth
1515
16impl 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() {
modifiedcrates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth
206 },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(())
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
346impl 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}
360359
modifiedcrates/jrsonnet-interner/src/inner.rsdiffbeforeafterboth
217impl 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 {
modifiedcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth

no syntactic changes

modifiedcrates/jrsonnet-stdlib/src/sort.rsdiffbeforeafterboth
26struct 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}
3838
modifiedflake.nixdiffbeforeafterboth
17 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 in
23 rec {23 rec {