difftreelog
Merge pull request #146 from CertainLach/fix/tests
in: master
Fix failing CI for tests and lints
22 files changed
cmds/jrsonnet-fmt/src/comments.rsdiffbeforeafterboth--- a/cmds/jrsonnet-fmt/src/comments.rs
+++ b/cmds/jrsonnet-fmt/src/comments.rs
@@ -72,7 +72,7 @@
if matches!(loc, CommentLocation::ItemInline) {
p!(pi: str(" "));
}
- p!(pi: str("/* ") string(lines[0].trim().to_string()) str(" */"))
+ p!(pi: str("/* ") string(lines[0].trim().to_string()) str(" */") nl)
} else if !lines.is_empty() {
fn common_ws_prefix<'a>(a: &'a str, b: &str) -> &'a str {
let offset = a
cmds/jrsonnet-fmt/src/main.rsdiffbeforeafterboth--- a/cmds/jrsonnet-fmt/src/main.rs
+++ b/cmds/jrsonnet-fmt/src/main.rs
@@ -372,8 +372,8 @@
return p!(new: str("{ }"));
}
let mut pi = p!(new: str("{") >i nl);
- for mem in children.into_iter() {
- if mem.should_start_with_newline {
+ for (i, mem) in children.into_iter().enumerate() {
+ if mem.should_start_with_newline && i != 0 {
p!(pi: nl);
}
p!(pi: items(format_comments(&mem.before_trivia, CommentLocation::AboveItem)));
crates/jrsonnet-cli/src/manifest.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/manifest.rs
+++ b/crates/jrsonnet-cli/src/manifest.rs
@@ -6,7 +6,7 @@
};
use jrsonnet_stdlib::{TomlFormat, YamlFormat};
-#[derive(Clone, ValueEnum)]
+#[derive(Clone, Copy, ValueEnum)]
pub enum ManifestFormatName {
/// Expect string as output, and write them directly
String,
@@ -18,9 +18,11 @@
#[derive(Parser)]
#[clap(next_help_heading = "MANIFESTIFICATION OUTPUT")]
pub struct ManifestOpts {
- /// Output format, wraps resulting value to corresponding std.manifest call.
- #[clap(long, short = 'f', default_value = "json")]
- format: ManifestFormatName,
+ /// Output format, wraps resulting value to corresponding std.manifest call
+ ///
+ /// [default: json, yaml when -y is used]
+ #[clap(long, short = 'f')]
+ format: Option<ManifestFormatName>,
/// Expect plain string as output.
/// Mutually exclusive with `--format`
#[clap(long, short = 'S', conflicts_with = "format")]
@@ -29,7 +31,9 @@
#[clap(long, short = 'y', conflicts_with = "string")]
yaml_stream: bool,
/// Number of spaces to pad output manifest with.
- /// `0` for hard tabs, `-1` for single line output [default: 3 for json, 2 for yaml/toml]
+ /// `0` for hard tabs, `-1` for single line output
+ ///
+ /// [default: 3 for json, 2 for yaml/toml]
#[clap(long)]
line_padding: Option<usize>,
/// Preserve order in object manifestification
@@ -44,7 +48,12 @@
} else {
#[cfg(feature = "exp-preserve-order")]
let preserve_order = self.preserve_order;
- match self.format {
+ let format = match self.format {
+ Some(v) => v,
+ None if self.yaml_stream => ManifestFormatName::Yaml,
+ None => ManifestFormatName::Json,
+ };
+ match format {
ManifestFormatName::String => Box::new(ToStringFormat),
ManifestFormatName::Json => Box::new(JsonFormat::cli(
self.line_padding.unwrap_or(3),
crates/jrsonnet-evaluator/src/arr/spec.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/arr/spec.rs
+++ b/crates/jrsonnet-evaluator/src/arr/spec.rs
@@ -372,7 +372,7 @@
pub fn new_inclusive(start: i32, end: i32) -> Self {
Self { start, end }
}
- fn range(&self) -> impl Iterator<Item = i32> + ExactSizeIterator + DoubleEndedIterator {
+ fn range(&self) -> impl ExactSizeIterator<Item = i32> + DoubleEndedIterator {
WithExactSize(
self.start..=self.end,
(self.end as usize)
@@ -461,7 +461,7 @@
ArrayThunk::Waiting(..) => {}
};
- let ArrayThunk::Waiting(_) =
+ let ArrayThunk::Waiting(()) =
replace(&mut self.cached.borrow_mut()[index], ArrayThunk::Pending)
else {
unreachable!()
@@ -508,7 +508,7 @@
match &self.cached.borrow()[index] {
ArrayThunk::Computed(c) => return Some(Thunk::evaluated(c.clone())),
ArrayThunk::Errored(e) => return Some(Thunk::errored(e.clone())),
- ArrayThunk::Waiting(_) | ArrayThunk::Pending => {}
+ ArrayThunk::Waiting(()) | ArrayThunk::Pending => {}
};
Some(Thunk::new(ArrayElement {
@@ -597,9 +597,7 @@
}
fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {
- let Some(key) = self.keys.get(index) else {
- return None;
- };
+ let key = self.keys.get(index)?;
Some(self.obj.get_lazy_or_bail(key.clone()))
}
@@ -649,9 +647,7 @@
}
fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {
- let Some(key) = self.keys.get(index) else {
- return None;
- };
+ let key = self.keys.get(index)?;
// Nothing can fail in the key part, yet value is still
// lazy-evaluated
Some(Thunk::evaluated(
crates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -89,7 +89,7 @@
specs: &[CompSpec],
callback: &mut impl FnMut(Context) -> Result<()>,
) -> Result<()> {
- match specs.get(0) {
+ match specs.first() {
None => callback(ctx)?,
Some(CompSpec::IfSpec(IfSpecData(cond))) => {
if bool::from_untyped(evaluate(ctx.clone(), cond)?)? {
crates/jrsonnet-evaluator/src/function/builtin.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/function/builtin.rs
+++ b/crates/jrsonnet-evaluator/src/function/builtin.rs
@@ -6,8 +6,8 @@
use super::{arglike::ArgsLike, parse::parse_builtin_call, CallLocation};
use crate::{gc::TraceBox, tb, Context, Result, Val};
-/// Can't have str | IStr, because constant BuiltinParam causes
-/// E0492: constant functions cannot refer to interior mutable data
+/// Can't have `str` | `IStr`, because constant `BuiltinParam` causes
+/// `E0492: constant functions cannot refer to interior mutable data`
#[derive(Clone, Trace)]
pub struct ParamName(Option<Cow<'static, str>>);
impl ParamName {
@@ -27,10 +27,9 @@
}
impl PartialEq<IStr> for ParamName {
fn eq(&self, other: &IStr) -> bool {
- match &self.0 {
- Some(s) => s.as_bytes() == other.as_bytes(),
- None => false,
- }
+ self.0
+ .as_ref()
+ .map_or(false, |s| s.as_bytes() == other.as_bytes())
}
}
@@ -87,7 +86,7 @@
params: params
.into_iter()
.map(|n| BuiltinParam {
- name: ParamName::new_dynamic(n.to_string()),
+ name: ParamName::new_dynamic(n),
has_default: false,
})
.collect(),
crates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/integrations/serde.rs
+++ b/crates/jrsonnet-evaluator/src/integrations/serde.rs
@@ -159,11 +159,11 @@
Val::Null => serializer.serialize_none(),
Val::Str(s) => serializer.serialize_str(&s.clone().into_flat()),
Val::Num(n) => {
- if n.fract() != 0.0 {
- serializer.serialize_f64(*n)
- } else {
+ if n.fract() == 0.0 {
let n = *n as i64;
serializer.serialize_i64(n)
+ } else {
+ serializer.serialize_f64(*n)
}
}
#[cfg(feature = "exp-bigint")]
crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -41,10 +41,12 @@
clippy::missing_const_for_fn,
// too many false-positives with .expect() calls
clippy::missing_panics_doc,
- // false positive for IStr type. There is an configuration option for
- // such cases, but it doesn't work:
- // https://github.com/rust-lang/rust-clippy/issues/9801
- clippy::mutable_key_type,
+ // false positive for IStr type. There is an configuration option for
+ // such cases, but it doesn't work:
+ // https://github.com/rust-lang/rust-clippy/issues/9801
+ clippy::mutable_key_type,
+ // false positives
+ clippy::redundant_pub_crate,
)]
// For jrsonnet-macros
crates/jrsonnet-evaluator/src/manifest.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/manifest.rs
+++ b/crates/jrsonnet-evaluator/src/manifest.rs
@@ -175,6 +175,8 @@
manifest_json_ex_buf(val, &mut out, &mut String::new(), options)?;
Ok(out)
}
+
+#[allow(clippy::too_many_lines)]
fn manifest_json_ex_buf(
val: &Val,
buf: &mut String,
crates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth1use std::{2 any::Any,3 cell::RefCell,4 fmt::Debug,5 hash::{Hash, Hasher},6 ptr::addr_of,7};89use jrsonnet_gcmodule::{Cc, Trace, Weak};10use jrsonnet_interner::IStr;11use jrsonnet_parser::{ExprLocation, Visibility};12use rustc_hash::FxHashMap;1314use crate::{15 arr::{PickObjectKeyValues, PickObjectValues},16 bail,17 error::{suggest_object_fields, Error, ErrorKind::*},18 function::{CallLocation, FuncVal},19 gc::{GcHashMap, GcHashSet, TraceBox},20 operator::evaluate_add_op,21 tb,22 val::{ArrValue, ThunkValue},23 MaybeUnbound, Result, State, Thunk, Unbound, Val,24};2526#[cfg(not(feature = "exp-preserve-order"))]27mod ordering {28 #![allow(29 // This module works as stub for preserve-order feature30 clippy::unused_self,31 )]3233 use jrsonnet_gcmodule::Trace;3435 #[derive(Clone, Copy, Default, Debug, Trace)]36 pub struct FieldIndex(());37 impl FieldIndex {38 pub const fn next(self) -> Self {39 Self(())40 }41 }4243 #[derive(Clone, Copy, Default, Debug, Trace)]44 pub struct SuperDepth(());45 impl SuperDepth {46 pub const fn deeper(self) -> Self {47 Self(())48 }49 }5051 #[derive(Clone, Copy)]52 pub struct FieldSortKey(());53 impl FieldSortKey {54 pub const fn new(_: SuperDepth, _: FieldIndex) -> Self {55 Self(())56 }57 }58}5960#[cfg(feature = "exp-preserve-order")]61mod ordering {62 use std::cmp::Reverse;6364 use jrsonnet_gcmodule::Trace;6566 #[derive(Clone, Copy, Default, Debug, Trace, PartialEq, Eq, PartialOrd, Ord)]67 pub struct FieldIndex(u32);68 impl FieldIndex {69 pub fn next(self) -> Self {70 Self(self.0 + 1)71 }72 }7374 #[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Debug)]75 pub struct SuperDepth(u32);76 impl SuperDepth {77 pub fn deeper(self) -> Self {78 Self(self.0 + 1)79 }80 }8182 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]83 pub struct FieldSortKey(Reverse<SuperDepth>, FieldIndex);84 impl FieldSortKey {85 pub fn new(depth: SuperDepth, index: FieldIndex) -> Self {86 Self(Reverse(depth), index)87 }88 }89}9091use ordering::*;9293// 0 - add94// 12 - visibility95#[derive(Clone, Copy)]96pub struct ObjFieldFlags(u8);97impl ObjFieldFlags {98 fn new(add: bool, visibility: Visibility) -> Self {99 let mut v = 0;100 if add {101 v |= 1;102 }103 v |= match visibility {104 Visibility::Normal => 0b000,105 Visibility::Hidden => 0b010,106 Visibility::Unhide => 0b100,107 };108 Self(v)109 }110 pub fn add(&self) -> bool {111 self.0 & 1 != 0112 }113 pub fn visibility(&self) -> Visibility {114 match (self.0 & 0b110) >> 1 {115 0b00 => Visibility::Normal,116 0b01 => Visibility::Hidden,117 0b10 => Visibility::Unhide,118 _ => unreachable!(),119 }120 }121}122impl Debug for ObjFieldFlags {123 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {124 f.debug_struct("ObjFieldFlags")125 .field("add", &self.add())126 .field("visibility", &self.visibility())127 .finish()128 }129}130131#[allow(clippy::module_name_repetitions)]132#[derive(Debug, Trace)]133pub struct ObjMember {134 #[trace(skip)]135 flags: ObjFieldFlags,136 original_index: FieldIndex,137 pub invoke: MaybeUnbound,138 pub location: Option<ExprLocation>,139}140141pub trait ObjectAssertion: Trace {142 fn run(&self, super_obj: Option<ObjValue>, this: Option<ObjValue>) -> Result<()>;143}144145// Field => This146147#[derive(Trace)]148enum CacheValue {149 Cached(Val),150 NotFound,151 Pending,152 Errored(Error),153}154155#[allow(clippy::module_name_repetitions)]156#[derive(Trace)]157#[trace(tracking(force))]158pub struct OopObject {159 sup: Option<ObjValue>,160 // this: Option<ObjValue>,161 assertions: Cc<Vec<TraceBox<dyn ObjectAssertion>>>,162 assertions_ran: RefCell<GcHashSet<ObjValue>>,163 this_entries: Cc<GcHashMap<IStr, ObjMember>>,164 value_cache: RefCell<GcHashMap<(IStr, Option<WeakObjValue>), CacheValue>>,165}166impl Debug for OopObject {167 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {168 f.debug_struct("OopObject")169 .field("sup", &self.sup)170 // .field("assertions", &self.assertions)171 // .field("assertions_ran", &self.assertions_ran)172 .field("this_entries", &self.this_entries)173 // .field("value_cache", &self.value_cache)174 .finish()175 }176}177178type EnumFieldsHandler<'a> = dyn FnMut(SuperDepth, FieldIndex, IStr, Visibility) -> bool + 'a;179180pub trait ObjectLike: Trace + Any + Debug {181 fn extend_from(&self, sup: ObjValue) -> ObjValue;182 /// When using standalone super in object, `this.super_obj.with_this(this)` is executed183 fn with_this(&self, me: ObjValue, this: ObjValue) -> ObjValue {184 ObjValue::new(ThisOverride { inner: me, this })185 }186 fn this(&self) -> Option<ObjValue> {187 None188 }189 fn len(&self) -> usize;190 fn is_empty(&self) -> bool;191 // If callback returns false, iteration stops192 fn enum_fields(&self, depth: SuperDepth, handler: &mut EnumFieldsHandler<'_>) -> bool;193194 fn has_field_include_hidden(&self, name: IStr) -> bool;195 fn has_field(&self, name: IStr) -> bool;196197 fn get_for(&self, key: IStr, this: ObjValue) -> Result<Option<Val>>;198 fn get_for_uncached(&self, key: IStr, this: ObjValue) -> Result<Option<Val>>;199 fn field_visibility(&self, field: IStr) -> Option<Visibility>;200201 fn run_assertions_raw(&self, this: ObjValue) -> Result<()>;202}203204#[derive(Clone, Trace)]205pub struct WeakObjValue(#[trace(skip)] pub(crate) Weak<TraceBox<dyn ObjectLike>>);206207impl PartialEq for WeakObjValue {208 fn eq(&self, other: &Self) -> bool {209 Weak::ptr_eq(&self.0, &other.0)210 }211}212213impl Eq for WeakObjValue {}214impl Hash for WeakObjValue {215 fn hash<H: Hasher>(&self, hasher: &mut H) {216 // Safety: usize is POD217 let addr = unsafe { *std::ptr::addr_of!(self.0).cast() };218 hasher.write_usize(addr);219 }220}221222#[allow(clippy::module_name_repetitions)]223#[derive(Clone, Trace, Debug)]224pub struct ObjValue(pub(crate) Cc<TraceBox<dyn ObjectLike>>);225226#[derive(Debug, Trace)]227struct EmptyObject;228impl ObjectLike for EmptyObject {229 fn extend_from(&self, sup: ObjValue) -> ObjValue {230 // obj + {} == obj231 sup232 }233234 fn this(&self) -> Option<ObjValue> {235 None236 }237238 fn len(&self) -> usize {239 0240 }241242 fn is_empty(&self) -> bool {243 true244 }245246 fn enum_fields(&self, _depth: SuperDepth, _handler: &mut EnumFieldsHandler<'_>) -> bool {247 false248 }249250 fn has_field_include_hidden(&self, _name: IStr) -> bool {251 false252 }253254 fn has_field(&self, _name: IStr) -> bool {255 false256 }257258 fn get_for(&self, _key: IStr, _this: ObjValue) -> Result<Option<Val>> {259 Ok(None)260 }261 fn get_for_uncached(&self, _key: IStr, _this: ObjValue) -> Result<Option<Val>> {262 Ok(None)263 }264265 fn run_assertions_raw(&self, _this: ObjValue) -> Result<()> {266 Ok(())267 }268269 fn field_visibility(&self, _field: IStr) -> Option<Visibility> {270 None271 }272}273274#[derive(Trace, Debug)]275struct ThisOverride {276 inner: ObjValue,277 this: ObjValue,278}279impl ObjectLike for ThisOverride {280 fn with_this(&self, _me: ObjValue, this: ObjValue) -> ObjValue {281 ObjValue::new(ThisOverride {282 inner: self.inner.clone(),283 this,284 })285 }286287 fn extend_from(&self, sup: ObjValue) -> ObjValue {288 self.inner.extend_from(sup).with_this(self.this.clone())289 }290291 fn this(&self) -> Option<ObjValue> {292 Some(self.this.clone())293 }294295 fn len(&self) -> usize {296 self.inner.len()297 }298299 fn is_empty(&self) -> bool {300 self.inner.is_empty()301 }302303 fn enum_fields(&self, depth: SuperDepth, handler: &mut EnumFieldsHandler<'_>) -> bool {304 self.inner.enum_fields(depth, handler)305 }306307 fn has_field_include_hidden(&self, name: IStr) -> bool {308 self.inner.has_field_include_hidden(name)309 }310311 fn has_field(&self, name: IStr) -> bool {312 self.inner.has_field(name)313 }314315 fn get_for(&self, key: IStr, this: ObjValue) -> Result<Option<Val>> {316 self.inner.get_for(key, this)317 }318319 fn get_for_uncached(&self, key: IStr, this: ObjValue) -> Result<Option<Val>> {320 self.inner.get_raw(key, this)321 }322323 fn field_visibility(&self, field: IStr) -> Option<Visibility> {324 self.inner.field_visibility(field)325 }326327 fn run_assertions_raw(&self, this: ObjValue) -> Result<()> {328 self.inner.run_assertions_raw(this)329 }330}331332impl ObjValue {333 pub fn new(v: impl ObjectLike) -> Self {334 Self(Cc::new(tb!(v)))335 }336 pub fn new_empty() -> Self {337 Self::new(EmptyObject)338 }339 pub fn builder() -> ObjValueBuilder {340 ObjValueBuilder::new()341 }342 pub fn builder_with_capacity(capacity: usize) -> ObjValueBuilder {343 ObjValueBuilder::with_capacity(capacity)344 }345 pub(crate) fn extend_with_raw_member(self, key: IStr, value: ObjMember) -> Self {346 let mut out = ObjValueBuilder::with_capacity(1);347 out.with_super(self);348 let mut member = out.field(key);349 if value.flags.add() {350 member = member.add()351 }352 if let Some(loc) = value.location {353 member = member.with_location(loc);354 }355 let _ = member356 .with_visibility(value.flags.visibility())357 .binding(value.invoke);358 out.build()359 }360 pub fn extend_field(&mut self, name: IStr) -> ObjMemberBuilder<ExtendBuilder<'_>> {361 ObjMemberBuilder::new(ExtendBuilder(self), name, FieldIndex::default())362 }363364 #[must_use]365 pub fn extend_from(&self, sup: Self) -> Self {366 self.0.extend_from(sup)367 }368 #[must_use]369 pub fn with_this(&self, this: Self) -> Self {370 self.0.with_this(self.clone(), this)371 }372 pub fn len(&self) -> usize {373 self.0.len()374 }375 pub fn is_empty(&self) -> bool {376 self.0.is_empty()377 }378 pub fn enum_fields(&self, depth: SuperDepth, handler: &mut EnumFieldsHandler<'_>) -> bool {379 self.0.enum_fields(depth, handler)380 }381382 pub fn has_field_include_hidden(&self, name: IStr) -> bool {383 self.0.has_field_include_hidden(name)384 }385 pub fn has_field(&self, name: IStr) -> bool {386 self.0.has_field(name)387 }388 pub fn has_field_ex(&self, name: IStr, include_hidden: bool) -> bool {389 if include_hidden {390 self.has_field_include_hidden(name)391 } else {392 self.has_field(name)393 }394 }395396 pub fn get(&self, key: IStr) -> Result<Option<Val>> {397 self.run_assertions()?;398 self.get_for(key, self.0.this().unwrap_or(self.clone()))399 }400401 pub fn get_for(&self, key: IStr, this: ObjValue) -> Result<Option<Val>> {402 self.0.get_for(key, this)403 }404405 pub fn get_or_bail(&self, key: IStr) -> Result<Val> {406 let Some(value) = self.get(key.clone())? else {407 let suggestions = suggest_object_fields(self, key.clone());408 bail!(NoSuchField(key, suggestions))409 };410 Ok(value)411 }412413 fn get_raw(&self, key: IStr, this: ObjValue) -> Result<Option<Val>> {414 self.0.get_for_uncached(key, this)415 }416417 fn field_visibility(&self, field: IStr) -> Option<Visibility> {418 self.0.field_visibility(field)419 }420421 pub fn run_assertions(&self) -> Result<()> {422 // FIXME: Should it use `self.0.this()` in case of standalone super?423 self.run_assertions_raw(self.clone())424 }425 fn run_assertions_raw(&self, this: ObjValue) -> Result<()> {426 self.0.run_assertions_raw(this)427 }428429 pub fn iter(430 &self,431 #[cfg(feature = "exp-preserve-order")] preserve_order: bool,432 ) -> impl Iterator<Item = (IStr, Result<Val>)> + '_ {433 let fields = self.fields(434 #[cfg(feature = "exp-preserve-order")]435 preserve_order,436 );437 fields.into_iter().map(|field| {438 (439 field.clone(),440 self.get(field)441 .map(|opt| opt.expect("iterating over keys, field exists")),442 )443 })444 }445 pub fn get_lazy(&self, key: IStr) -> Option<Thunk<Val>> {446 #[derive(Trace)]447 struct ThunkGet {448 obj: ObjValue,449 key: IStr,450 }451 impl ThunkValue for ThunkGet {452 type Output = Val;453454 fn get(self: Box<Self>) -> Result<Self::Output> {455 Ok(self.obj.get(self.key)?.expect("field exists"))456 }457 }458459 if !self.has_field_ex(key.clone(), true) {460 return None;461 }462 Some(Thunk::new(ThunkGet {463 obj: self.clone(),464 key,465 }))466 }467 pub fn get_lazy_or_bail(&self, key: IStr) -> Thunk<Val> {468 #[derive(Trace)]469 struct ThunkGet {470 obj: ObjValue,471 key: IStr,472 }473 impl ThunkValue for ThunkGet {474 type Output = Val;475476 fn get(self: Box<Self>) -> Result<Self::Output> {477 Ok(self.obj.get_or_bail(self.key)?)478 }479 }480481 Thunk::new(ThunkGet {482 obj: self.clone(),483 key,484 })485 }486 pub fn ptr_eq(a: &Self, b: &Self) -> bool {487 Cc::ptr_eq(&a.0, &b.0)488 }489 pub fn downgrade(self) -> WeakObjValue {490 WeakObjValue(self.0.downgrade())491 }492 fn fields_visibility(&self) -> FxHashMap<IStr, (bool, FieldSortKey)> {493 let mut out = FxHashMap::default();494 self.enum_fields(495 SuperDepth::default(),496 &mut |depth, index, name, visibility| {497 let new_sort_key = FieldSortKey::new(depth, index);498 let entry = out.entry(name.clone());499 let (visible, _) = entry.or_insert((true, new_sort_key));500 match visibility {501 Visibility::Normal => {}502 Visibility::Hidden => {503 *visible = false;504 }505 Visibility::Unhide => {506 *visible = true;507 }508 };509 false510 },511 );512 out513 }514 pub fn fields_ex(515 &self,516 include_hidden: bool,517 #[cfg(feature = "exp-preserve-order")] preserve_order: bool,518 ) -> Vec<IStr> {519 #[cfg(feature = "exp-preserve-order")]520 if preserve_order {521 let (mut fields, mut keys): (Vec<_>, Vec<_>) = self522 .fields_visibility()523 .into_iter()524 .filter(|(_, (visible, _))| include_hidden || *visible)525 .enumerate()526 .map(|(idx, (k, (_, sk)))| (k, (sk, idx)))527 .unzip();528 keys.sort_unstable_by_key(|v| v.0);529 // Reorder in-place by resulting indexes530 for i in 0..fields.len() {531 let x = fields[i].clone();532 let mut j = i;533 loop {534 let k = keys[j].1;535 keys[j].1 = j;536 if k == i {537 break;538 }539 fields[j] = fields[k].clone();540 j = k;541 }542 fields[j] = x;543 }544 return fields;545 }546547 let mut fields: Vec<_> = self548 .fields_visibility()549 .into_iter()550 .filter(|(_, (visible, _))| include_hidden || *visible)551 .map(|(k, _)| k)552 .collect();553 fields.sort_unstable();554 fields555 }556 pub fn fields(&self, #[cfg(feature = "exp-preserve-order")] preserve_order: bool) -> Vec<IStr> {557 self.fields_ex(558 false,559 #[cfg(feature = "exp-preserve-order")]560 preserve_order,561 )562 }563 pub fn values_ex(564 &self,565 include_hidden: bool,566 #[cfg(feature = "exp-preserve-order")] preserve_order: bool,567 ) -> ArrValue {568 ArrValue::new(PickObjectValues::new(569 self.clone(),570 self.fields_ex(571 include_hidden,572 #[cfg(feature = "exp-preserve-order")]573 preserve_order,574 ),575 ))576 }577 pub fn values(&self, #[cfg(feature = "exp-preserve-order")] preserve_order: bool) -> ArrValue {578 self.values_ex(579 false,580 #[cfg(feature = "exp-preserve-order")]581 preserve_order,582 )583 }584 pub fn key_values_ex(585 &self,586 include_hidden: bool,587 #[cfg(feature = "exp-preserve-order")] preserve_order: bool,588 ) -> ArrValue {589 ArrValue::new(PickObjectKeyValues::new(590 self.clone(),591 self.fields_ex(592 include_hidden,593 #[cfg(feature = "exp-preserve-order")]594 preserve_order,595 ),596 ))597 }598 pub fn key_values(599 &self,600 #[cfg(feature = "exp-preserve-order")] preserve_order: bool,601 ) -> ArrValue {602 self.key_values_ex(603 false,604 #[cfg(feature = "exp-preserve-order")]605 preserve_order,606 )607 }608}609610impl OopObject {611 pub fn new(612 sup: Option<ObjValue>,613 this_entries: Cc<GcHashMap<IStr, ObjMember>>,614 assertions: Cc<Vec<TraceBox<dyn ObjectAssertion>>>,615 ) -> Self {616 Self {617 sup,618 // this: None,619 assertions,620 assertions_ran: RefCell::new(GcHashSet::new()),621 this_entries,622 value_cache: RefCell::new(GcHashMap::new()),623 }624 }625626 fn evaluate_this(&self, v: &ObjMember, real_this: ObjValue) -> Result<Val> {627 v.invoke.evaluate(self.sup.clone(), Some(real_this))628 }629630 // FIXME: Duplication between ObjValue and OopObject631 fn fields_visibility(&self) -> FxHashMap<IStr, (bool, FieldSortKey)> {632 let mut out = FxHashMap::default();633 self.enum_fields(634 SuperDepth::default(),635 &mut |depth, index, name, visibility| {636 let new_sort_key = FieldSortKey::new(depth, index);637 let entry = out.entry(name.clone());638 let (visible, _) = entry.or_insert((true, new_sort_key));639 match visibility {640 Visibility::Normal => {}641 Visibility::Hidden => {642 *visible = false;643 }644 Visibility::Unhide => {645 *visible = true;646 }647 };648 false649 },650 );651 out652 }653}654655impl ObjectLike for OopObject {656 fn extend_from(&self, sup: ObjValue) -> ObjValue {657 ObjValue::new(match &self.sup {658 None => Self::new(659 Some(sup),660 self.this_entries.clone(),661 self.assertions.clone(),662 ),663 Some(v) => Self::new(664 Some(v.extend_from(sup)),665 self.this_entries.clone(),666 self.assertions.clone(),667 ),668 })669 }670671 fn len(&self) -> usize {672 self.fields_visibility()673 .into_iter()674 .filter(|(_, (visible, _))| *visible)675 .count()676 }677678 fn is_empty(&self) -> bool {679 if !self.this_entries.is_empty() {680 return false;681 }682 self.sup.as_ref().map_or(true, ObjValue::is_empty)683 }684685 /// Run callback for every field found in object686 ///687 /// Returns true if ended prematurely688 fn enum_fields(&self, depth: SuperDepth, handler: &mut EnumFieldsHandler<'_>) -> bool {689 if let Some(s) = &self.sup {690 if s.enum_fields(depth.deeper(), handler) {691 return true;692 }693 }694 for (name, member) in self.this_entries.iter() {695 if handler(696 depth,697 member.original_index,698 name.clone(),699 member.flags.visibility(),700 ) {701 return true;702 }703 }704 false705 }706707 fn has_field_include_hidden(&self, name: IStr) -> bool {708 if self.this_entries.contains_key(&name) {709 true710 } else if let Some(super_obj) = &self.sup {711 super_obj.has_field_include_hidden(name)712 } else {713 false714 }715 }716 fn has_field(&self, name: IStr) -> bool {717 self.field_visibility(name)718 .map_or(false, |v| v.is_visible())719 }720721 fn get_for(&self, key: IStr, this: ObjValue) -> Result<Option<Val>> {722 let cache_key = (key.clone(), Some(this.clone().downgrade()));723 if let Some(v) = self.value_cache.borrow().get(&cache_key) {724 return Ok(match v {725 CacheValue::Cached(v) => Some(v.clone()),726 CacheValue::NotFound => None,727 CacheValue::Pending => bail!(InfiniteRecursionDetected),728 CacheValue::Errored(e) => return Err(e.clone()),729 });730 }731 self.value_cache732 .borrow_mut()733 .insert(cache_key.clone(), CacheValue::Pending);734 let value = self.get_for_uncached(key, this).map_err(|e| {735 self.value_cache736 .borrow_mut()737 .insert(cache_key.clone(), CacheValue::Errored(e.clone()));738 e739 })?;740 self.value_cache.borrow_mut().insert(741 cache_key,742 value743 .as_ref()744 .map_or(CacheValue::NotFound, |v| CacheValue::Cached(v.clone())),745 );746 Ok(value)747 }748 fn get_for_uncached(&self, key: IStr, real_this: ObjValue) -> Result<Option<Val>> {749 match (self.this_entries.get(&key), &self.sup) {750 (Some(k), None) => Ok(Some(self.evaluate_this(k, real_this)?)),751 (Some(k), Some(super_obj)) => {752 let our = self.evaluate_this(k, real_this.clone())?;753 if k.flags.add() {754 super_obj755 .get_raw(key, real_this)?756 .map_or(Ok(Some(our.clone())), |v| {757 Ok(Some(evaluate_add_op(&v, &our)?))758 })759 } else {760 Ok(Some(our))761 }762 }763 (None, Some(super_obj)) => super_obj.get_raw(key, real_this),764 (None, None) => Ok(None),765 }766 }767 fn field_visibility(&self, name: IStr) -> Option<Visibility> {768 if let Some(m) = self.this_entries.get(&name) {769 Some(match &m.flags.visibility() {770 Visibility::Normal => self771 .sup772 .as_ref()773 .and_then(|super_obj| super_obj.field_visibility(name))774 .unwrap_or(Visibility::Normal),775 v => *v,776 })777 } else if let Some(super_obj) = &self.sup {778 super_obj.field_visibility(name)779 } else {780 None781 }782 }783784 fn run_assertions_raw(&self, real_this: ObjValue) -> Result<()> {785 if self.assertions.is_empty() {786 if let Some(super_obj) = &self.sup {787 super_obj.run_assertions_raw(real_this)?;788 }789 return Ok(());790 }791 if self.assertions_ran.borrow_mut().insert(real_this.clone()) {792 for assertion in self.assertions.iter() {793 if let Err(e) = assertion.run(self.sup.clone(), Some(real_this.clone())) {794 self.assertions_ran.borrow_mut().remove(&real_this);795 return Err(e);796 }797 }798 if let Some(super_obj) = &self.sup {799 super_obj.run_assertions_raw(real_this)?;800 }801 }802 Ok(())803 }804}805806impl PartialEq for ObjValue {807 fn eq(&self, other: &Self) -> bool {808 Cc::ptr_eq(&self.0, &other.0)809 }810}811812impl Eq for ObjValue {}813impl Hash for ObjValue {814 fn hash<H: Hasher>(&self, hasher: &mut H) {815 hasher.write_usize(addr_of!(*self.0) as usize);816 }817}818819#[allow(clippy::module_name_repetitions)]820pub struct ObjValueBuilder {821 sup: Option<ObjValue>,822 map: GcHashMap<IStr, ObjMember>,823 assertions: Vec<TraceBox<dyn ObjectAssertion>>,824 next_field_index: FieldIndex,825}826impl ObjValueBuilder {827 pub fn new() -> Self {828 Self::with_capacity(0)829 }830 pub fn with_capacity(capacity: usize) -> Self {831 Self {832 sup: None,833 map: GcHashMap::with_capacity(capacity),834 assertions: Vec::new(),835 next_field_index: FieldIndex::default(),836 }837 }838 pub fn reserve_asserts(&mut self, capacity: usize) -> &mut Self {839 self.assertions.reserve_exact(capacity);840 self841 }842 pub fn with_super(&mut self, super_obj: ObjValue) -> &mut Self {843 self.sup = Some(super_obj);844 self845 }846847 pub fn assert(&mut self, assertion: impl ObjectAssertion + 'static) -> &mut Self {848 self.assertions.push(tb!(assertion));849 self850 }851 pub fn field(&mut self, name: impl Into<IStr>) -> ObjMemberBuilder<ValueBuilder<'_>> {852 let field_index = self.next_field_index;853 self.next_field_index = self.next_field_index.next();854 ObjMemberBuilder::new(ValueBuilder(self), name.into(), field_index)855 }856 /// Preset for common method definiton pattern:857 /// Create a hidden field with the function value.858 ///859 /// `.field(name).hide().value(Val::function(value))`860 pub fn method(&mut self, name: impl Into<IStr>, value: impl Into<FuncVal>) -> &mut Self {861 self.field(name).hide().value(Val::Func(value.into()));862 self863 }864 pub fn try_method(865 &mut self,866 name: impl Into<IStr>,867 value: impl Into<FuncVal>,868 ) -> Result<&mut Self> {869 self.field(name).hide().try_value(Val::Func(value.into()))?;870 Ok(self)871 }872873 pub fn build(self) -> ObjValue {874 if self.sup.is_none() && self.map.is_empty() && self.assertions.is_empty() {875 return ObjValue::new_empty();876 }877 ObjValue::new(OopObject::new(878 self.sup,879 Cc::new(self.map),880 Cc::new(self.assertions),881 ))882 }883}884impl Default for ObjValueBuilder {885 fn default() -> Self {886 Self::with_capacity(0)887 }888}889890#[allow(clippy::module_name_repetitions)]891#[must_use = "value not added unless binding() was called"]892pub struct ObjMemberBuilder<Kind> {893 kind: Kind,894 name: IStr,895 add: bool,896 visibility: Visibility,897 original_index: FieldIndex,898 location: Option<ExprLocation>,899}900901#[allow(clippy::missing_const_for_fn)]902impl<Kind> ObjMemberBuilder<Kind> {903 pub(crate) fn new(kind: Kind, name: IStr, original_index: FieldIndex) -> Self {904 Self {905 kind,906 name,907 original_index,908 add: false,909 visibility: Visibility::Normal,910 location: None,911 }912 }913914 pub const fn with_add(mut self, add: bool) -> Self {915 self.add = add;916 self917 }918 pub fn add(self) -> Self {919 self.with_add(true)920 }921 pub fn with_visibility(mut self, visibility: Visibility) -> Self {922 self.visibility = visibility;923 self924 }925 pub fn hide(self) -> Self {926 self.with_visibility(Visibility::Hidden)927 }928 pub fn with_location(mut self, location: ExprLocation) -> Self {929 self.location = Some(location);930 self931 }932 fn build_member(self, binding: MaybeUnbound) -> (Kind, IStr, ObjMember) {933 (934 self.kind,935 self.name,936 ObjMember {937 flags: ObjFieldFlags::new(self.add, self.visibility),938 original_index: self.original_index,939 invoke: binding,940 location: self.location,941 },942 )943 }944}945946pub struct ValueBuilder<'v>(&'v mut ObjValueBuilder);947impl ObjMemberBuilder<ValueBuilder<'_>> {948 /// Inserts value, replacing if it is already defined949 pub fn value(self, value: impl Into<Val>) {950 let (receiver, name, member) =951 self.build_member(MaybeUnbound::Bound(Thunk::evaluated(value.into())));952 let entry = receiver.0.map.entry(name);953 entry.insert(member);954 }955956 /// Tries to insert value, returns an error if it was already defined957 pub fn try_value(self, value: impl Into<Val>) -> Result<()> {958 self.thunk(Thunk::evaluated(value.into()))959 }960 pub fn thunk(self, value: impl Into<Thunk<Val>>) -> Result<()> {961 self.binding(MaybeUnbound::Bound(value.into()))962 }963 pub fn bindable(self, bindable: impl Unbound<Bound = Val>) -> Result<()> {964 self.binding(MaybeUnbound::Unbound(Cc::new(tb!(bindable))))965 }966 pub fn binding(self, binding: MaybeUnbound) -> Result<()> {967 let (receiver, name, member) = self.build_member(binding);968 let location = member.location.clone();969 let old = receiver.0.map.insert(name.clone(), member);970 if old.is_some() {971 State::push(972 CallLocation(location.as_ref()),973 || format!("field <{}> initializtion", name.clone()),974 || bail!(DuplicateFieldName(name.clone())),975 )?;976 }977 Ok(())978 }979}980981pub struct ExtendBuilder<'v>(&'v mut ObjValue);982impl ObjMemberBuilder<ExtendBuilder<'_>> {983 pub fn value(self, value: impl Into<Val>) {984 self.binding(MaybeUnbound::Bound(Thunk::evaluated(value.into())));985 }986 pub fn bindable(self, bindable: TraceBox<dyn Unbound<Bound = Val>>) {987 self.binding(MaybeUnbound::Unbound(Cc::new(bindable)));988 }989 pub fn binding(self, binding: MaybeUnbound) {990 let (receiver, name, member) = self.build_member(binding);991 let new = receiver.0.clone();992 *receiver.0 = new.extend_with_raw_member(name, member);993 }994}crates/jrsonnet-evaluator/src/stdlib/format.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/stdlib/format.rs
+++ b/crates/jrsonnet-evaluator/src/stdlib/format.rs
@@ -248,7 +248,7 @@
let (cflags, str) = try_parse_cflags(str)?;
let (width, str) = try_parse_field_width(str)?;
let (precision, str) = try_parse_precision(str)?;
- let (_, str) = try_parse_length_modifier(str)?;
+ let ((), str) = try_parse_length_modifier(str)?;
let (convtype, str) = parse_conversion_type(str)?;
Ok((
crates/jrsonnet-evaluator/src/typed/conversions.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/typed/conversions.rs
+++ b/crates/jrsonnet-evaluator/src/typed/conversions.rs
@@ -449,25 +449,21 @@
}
fn from_untyped(value: Val) -> Result<Self> {
- match &value {
- Val::Arr(a) => {
- if let Some(bytes) = a.as_any().downcast_ref::<BytesArray>() {
- return Ok(bytes.0.as_slice().into());
- };
- <Self as Typed>::TYPE.check(&value)?;
- // Any::downcast_ref::<ByteArray>(&a);
- let mut out = Vec::with_capacity(a.len());
- for e in a.iter() {
- let r = e?;
- out.push(u8::from_untyped(r)?);
- }
- Ok(out.as_slice().into())
- }
- _ => {
- <Self as Typed>::TYPE.check(&value)?;
- unreachable!()
- }
+ let Val::Arr(a) = &value else {
+ <Self as Typed>::TYPE.check(&value)?;
+ unreachable!()
+ };
+ if let Some(bytes) = a.as_any().downcast_ref::<BytesArray>() {
+ return Ok(bytes.0.as_slice().into());
+ };
+ <Self as Typed>::TYPE.check(&value)?;
+ // Any::downcast_ref::<ByteArray>(&a);
+ let mut out = Vec::with_capacity(a.len());
+ for e in a.iter() {
+ let r = e?;
+ out.push(u8::from_untyped(r)?);
}
+ Ok(out.as_slice().into())
}
}
crates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/typed/mod.rs
+++ b/crates/jrsonnet-evaluator/src/typed/mod.rs
@@ -90,7 +90,7 @@
item: impl Fn() -> Result<()>,
) -> Result<()> {
State::push_description(error_reason, || match item() {
- Ok(_) => Ok(()),
+ Ok(()) => Ok(()),
Err(mut e) => {
if let ErrorKind::TypeError(e) = &mut e.error_mut() {
(e.1).0.push(path());
crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -351,6 +351,8 @@
}
}
impl PartialEq for StrValue {
+ // False positive, into_flat returns not StrValue, but IStr, thus no infinite recursion here.
+ #[allow(clippy::unconditional_recursion)]
fn eq(&self, other: &Self) -> bool {
let a = self.clone().into_flat();
let b = other.clone().into_flat();
crates/jrsonnet-interner/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-interner/src/lib.rs
+++ b/crates/jrsonnet-interner/src/lib.rs
@@ -6,7 +6,7 @@
#![warn(clippy::pedantic, clippy::nursery)]
#![allow(clippy::missing_const_for_fn)]
use std::{
- borrow::{Borrow, Cow},
+ borrow::Cow,
cell::RefCell,
fmt::{self, Display},
hash::{BuildHasherDefault, Hash, Hasher},
@@ -14,7 +14,7 @@
str,
};
-use hashbrown::HashMap;
+use hashbrown::{hash_map::RawEntryMut, HashMap};
use jrsonnet_gcmodule::Trace;
use rustc_hash::FxHasher;
@@ -57,17 +57,6 @@
}
}
-impl Borrow<str> for IStr {
- fn borrow(&self) -> &str {
- self.as_str()
- }
-}
-impl Borrow<[u8]> for IStr {
- fn borrow(&self) -> &[u8] {
- self.as_bytes()
- }
-}
-
impl PartialEq for IStr {
fn eq(&self, other: &Self) -> bool {
// all IStr should be inlined into same pool
@@ -142,12 +131,6 @@
type Target = [u8];
fn deref(&self) -> &Self::Target {
- self.0.as_slice()
- }
-}
-
-impl Borrow<[u8]> for IBytes {
- fn borrow(&self) -> &[u8] {
self.0.as_slice()
}
}
@@ -285,9 +268,9 @@
let mut pool = pool.borrow_mut();
let entry = pool.raw_entry_mut().from_key(bytes);
match entry {
- hashbrown::hash_map::RawEntryMut::Occupied(i) => IBytes(i.get_key_value().0.clone()),
- hashbrown::hash_map::RawEntryMut::Vacant(e) => {
- let (k, _) = e.insert(Inner::new_bytes(bytes), ());
+ RawEntryMut::Occupied(i) => IBytes(i.get_key_value().0.clone()),
+ RawEntryMut::Vacant(e) => {
+ let (k, ()) = e.insert(Inner::new_bytes(bytes), ());
IBytes(k.clone())
}
}
crates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-macros/src/lib.rs
+++ b/crates/jrsonnet-macros/src/lib.rs
@@ -374,6 +374,7 @@
fn params(&self) -> &[BuiltinParam] {
PARAMS
}
+ #[allow(unused_variable)]
fn call(&self, ctx: Context, location: CallLocation, args: &dyn ArgsLike) -> Result<Val> {
let parsed = parse_builtin_call(ctx.clone(), &PARAMS, args, false)?;
crates/jrsonnet-stdlib/src/encoding.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/encoding.rs
+++ b/crates/jrsonnet-stdlib/src/encoding.rs
@@ -39,5 +39,5 @@
let bytes = STANDARD
.decode(str.as_bytes())
.map_err(|e| runtime_error!("invalid base64: {e}"))?;
- Ok(String::from_utf8(bytes).map_err(|_| runtime_error!("bad utf8"))?)
+ String::from_utf8(bytes).map_err(|_| runtime_error!("bad utf8"))
}
crates/jrsonnet-stdlib/src/manifest/yaml.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/manifest/yaml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/yaml.rs
@@ -134,6 +134,14 @@
buf.push_str(&options.padding);
buf.push_str(line);
}
+ } else if s.contains('\n') {
+ buf.push_str("|-");
+ for line in s.split('\n') {
+ buf.push('\n');
+ buf.push_str(cur_padding);
+ buf.push_str(&options.padding);
+ buf.push_str(line);
+ }
} else if !options.quote_keys && !yaml_needs_quotes(&s) {
buf.push_str(&s);
} else {
crates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/misc.rs
+++ b/crates/jrsonnet-stdlib/src/misc.rs
@@ -47,7 +47,7 @@
.ext_natives
.get(&x)
.cloned()
- .map_or(Val::Null, |v| Val::Func(v))
+ .map_or(Val::Null, Val::Func)
}
#[builtin(fields(
flake.lockdiffbeforeafterboth--- a/flake.lock
+++ b/flake.lock
@@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
- "lastModified": 1694529238,
- "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
+ "lastModified": 1705309234,
+ "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
- "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
+ "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
@@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1701376520,
- "narHash": "sha256-U3iGiOZqgu7wvVzgfoQzGGFMqNsDj/q/6zPIjCy7ajg=",
+ "lastModified": 1705391267,
+ "narHash": "sha256-gGVm9QudiRtYTX8PN9cTTy7uuJcL4I2lRMoPx496kXk=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "c74cc3c3db2ed5e68895953d75c397797d499133",
+ "rev": "41a9a7f170c740acb24f3390323877d11c69d5ee",
"type": "github"
},
"original": {
@@ -50,11 +50,11 @@
]
},
"locked": {
- "lastModified": 1701310566,
- "narHash": "sha256-CL9J3xUR2Ejni4LysrEGX0IdO+Y4BXCiH/By0lmF3eQ=",
+ "lastModified": 1705371439,
+ "narHash": "sha256-P1kulUXpYWkcrjiX3sV4j8ACJZh9XXSaaD+jDLBDLKo=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "6d3c6e185198b8bf7ad639f22404a75aa9a09bff",
+ "rev": "b21f3c0d5bf0f0179f5f0140e8e0cd099618bd04",
"type": "github"
},
"original": {
flake.nixdiffbeforeafterboth--- a/flake.nix
+++ b/flake.nix
@@ -25,14 +25,14 @@
lib = pkgs.lib;
rust =
(pkgs.rustChannelOf {
- date = "2023-10-28";
+ date = "2024-01-10";
channel = "nightly";
})
.default
.override {
extensions = ["rust-src" "miri" "rust-analyzer" "clippy"];
};
- in rec {
+ in {
packages = rec {
go-jsonnet = pkgs.callPackage ./nix/go-jsonnet.nix {};
sjsonnet = pkgs.callPackage ./nix/sjsonnet.nix {};
tests/suite/std_param_names.jsonnetdiffbeforeafterboth--- a/tests/suite/std_param_names.jsonnet
+++ b/tests/suite/std_param_names.jsonnet
@@ -103,6 +103,7 @@
asin: ['x'],
acos: ['x'],
atan: ['x'],
+ atan2: ['y', 'x'],
type: ['x'],
filter: ['func', 'arr'],
objectHasEx: ['obj', 'fname', 'hidden'],