difftreelog
style fix clippy warnings
in: master
2 files changed
crates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -128,8 +128,7 @@
new_bindings,
)?;
}
- Some(DestructRest::Drop) => {}
- None => {}
+ Some(DestructRest::Drop) | None => {}
}
{
@@ -202,7 +201,7 @@
.collect();
let full = Thunk::new(tb!(DataThunk {
parent,
- field_names: field_names.clone(),
+ field_names,
has_rest: rest.is_some()
}));
@@ -222,7 +221,7 @@
Ok(field)
} else {
let (fctx, expr) = self.default.as_ref().expect("shape is checked");
- Ok(evaluate(fctx.clone().unwrap(), &expr)?)
+ Ok(evaluate(fctx.clone().unwrap(), expr)?)
}
}
}
crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth44extern crate self as jrsonnet_evaluator;44extern crate self as jrsonnet_evaluator;454546mod arr;46mod arr;47#[cfg(feature = "async-import")]48pub mod async_import;47mod ctx;49mod ctx;48mod dynamic;50mod dynamic;49pub mod error;51pub mod error;188 evaluating: false,190 evaluating: false,189 }191 }190 }192 }193 pub(crate) fn get_string(&mut self) -> Option<IStr> {194 if self.string.is_none() {195 self.string = Some(196 self.bytes197 .as_ref()198 .expect("either string or bytes should be set")199 .clone()200 .cast_str()?,201 );202 }203 Some(self.string.clone().expect("just set"))204 }191}205}192206193#[derive(Default, Trace)]207#[derive(Default, Trace)]223 .1237 .1224 }238 }225 };239 };226 if let Some(str) = &file.string {227 return Ok(str.clone());228 }229 if file.string.is_none() {230 file.string = Some(240 Ok(file231 file.bytes232 .as_ref()233 .expect("either string or bytes should be set")234 .clone()235 .cast_str()241 .get_string()236 .ok_or_else(|| ImportBadFileUtf8(path.clone()))?,242 .ok_or_else(|| ImportBadFileUtf8(path.clone()))?)237 );238 }239 Ok(file.string.as_ref().expect("just set").clone())240 }243 }241 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise244 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise242 pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes> {245 pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes> {288 if let Some(val) = &file.evaluated {291 if let Some(val) = &file.evaluated {289 return Ok(val.clone());292 return Ok(val.clone());290 }293 }291 if file.string.is_none() {294 let code = file295 .get_string()292 file.string = Some(296 .ok_or_else(|| ImportBadFileUtf8(path.clone()))?;293 std::str::from_utf8(294 file.bytes295 .as_ref()296 .expect("either string or bytes should be set"),297 )298 .map_err(|_| ImportBadFileUtf8(path.clone()))?299 .into(),300 );301 }302 let code = file.string.as_ref().expect("just set");303 let file_name = Source::new(path.clone(), code.clone());297 let file_name = Source::new(path.clone(), code.clone());304 if file.parsed.is_none() {298 if file.parsed.is_none() {305 file.parsed = Some(299 file.parsed = Some(306 jrsonnet_parser::parse(300 jrsonnet_parser::parse(307 code,301 &code,308 &ParserSettings {302 &ParserSettings {309 source: file_name.clone(),303 source: file_name.clone(),310 },304 },