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

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2022-08-07parent: #aa97bc0.patch.diff
in: master

5 files changed

modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -596,7 +596,7 @@
 	}
 	pub fn add_tla_code(&self, name: IStr, code: &str) -> Result<()> {
 		let source_name = format!("<top-level-arg:{}>", name);
-		let source = Source::new_virtual(Cow::Owned(source_name.clone()), code.into());
+		let source = Source::new_virtual(Cow::Owned(source_name), code.into());
 		let parsed = jrsonnet_parser::parse(
 			code,
 			&ParserSettings {
modifiedcrates/jrsonnet-evaluator/src/trace/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/trace/mod.rs
+++ b/crates/jrsonnet-evaluator/src/trace/mod.rs
@@ -237,7 +237,7 @@
 				let start_end = source.0.map_source_locations(&[source.1, source.2]);
 				self.print_snippet(
 					out,
-					&source.0.code(),
+					source.0.code(),
 					&source.0,
 					&start_end[0],
 					&start_end[1],
modifiedcrates/jrsonnet-stdlib/build.rsdiffbeforeafterboth
before · crates/jrsonnet-stdlib/build.rs
1use std::{borrow::Cow, env, fs::File, io::Write, path::Path};23use jrsonnet_parser::{parse, ParserSettings, Source};4use structdump::CodegenResult;56fn main() {7	let parsed = parse(8		include_str!("./src/std.jsonnet"),9		&ParserSettings {10			file_name: Source::new_virtual(11				Cow::Borrowed("<std>"),12				include_str!("./src/std.jsonnet").into(),13			),14		},15	)16	.expect("parse");1718	let mut out = CodegenResult::default();1920	let v = out.codegen(&parsed, true);2122	{23		let out_dir = env::var("OUT_DIR").unwrap();24		let dest_path = Path::new(&out_dir).join("stdlib.rs");25		let mut f = File::create(&dest_path).unwrap();26		f.write_all(v.to_string().replace(';', ";\n").as_bytes())27			.unwrap();28	}29}
after · crates/jrsonnet-stdlib/build.rs
1use std::{borrow::Cow, env, fs::File, io::Write, path::Path};23use jrsonnet_parser::{parse, ParserSettings, Source};4use structdump::CodegenResult;56fn main() {7	let parsed = parse(8		include_str!("./src/std.jsonnet"),9		&ParserSettings {10			file_name: Source::new_virtual(11				Cow::Borrowed("<std>"),12				include_str!("./src/std.jsonnet").into(),13			),14		},15	)16	.expect("parse");1718	let mut out = CodegenResult::default();1920	let v = out.codegen(&parsed, true);2122	{23		let out_dir = env::var("OUT_DIR").unwrap();24		let dest_path = Path::new(&out_dir).join("stdlib.rs");25		let mut f = File::create(&dest_path).unwrap();26		f.write_all(27			("#[allow(clippy::redundant_clone)]".to_owned() + &v.to_string())28				.replace(';', ";\n")29				.as_bytes(),30		)31		.unwrap();32	}33}
modifiedcrates/jrsonnet-stdlib/src/expr.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/expr.rs
+++ b/crates/jrsonnet-stdlib/src/expr.rs
@@ -1,11 +1,9 @@
 use jrsonnet_parser::LocExpr;
 
 mod structdump_import {
-	pub(super) use std::{borrow::Cow, rc::Rc};
+	pub(super) use std::{borrow::Cow, option::Option, rc::Rc, vec};
 
 	pub(super) use jrsonnet_parser::*;
-	pub(super) use vec;
-	pub(super) use Option;
 }
 
 pub fn stdlib_expr() -> LocExpr {
modifiedcrates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -465,6 +465,7 @@
 	Ok(out.into())
 }
 
+#[allow(clippy::comparison_chain)]
 #[builtin]
 fn builtin_starts_with(
 	s: State,
@@ -497,6 +498,7 @@
 	})
 }
 
+#[allow(clippy::comparison_chain)]
 #[builtin]
 fn builtin_ends_with(
 	s: State,