git.delta.rocks / jrsonnet / refs/commits / 696afe01731f

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2021-11-27parent: #a7408d3.patch.diff
in: master

3 files changed

modifiedcrates/jrsonnet-evaluator/src/gc.rsdiffbeforeafterboth
18 }18 }
1919
20 fn is_type_tracked() -> bool {20 fn is_type_tracked() -> bool {
21 return true;21 true
22 }22 }
23}23}
2424
101 &mut self.0101 &mut self.0
102 }102 }
103}103}
104impl<V> Default for GcHashSet<V> {
105 fn default() -> Self {
106 Self::new()
107 }
108}
104109
105#[derive(Clone)]110#[derive(Clone)]
106pub struct GcHashMap<K, V>(pub FxHashMap<K, V>);111pub struct GcHashMap<K, V>(pub FxHashMap<K, V>);
139 &mut self.0144 &mut self.0
140 }145 }
141}146}
147impl<K, V> Default for GcHashMap<K, V> {
148 fn default() -> Self {
149 Self::new()
150 }
151}
142152
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -125,6 +125,7 @@
 	evaluated: Option<Val>,
 }
 
+#[allow(clippy::type_complexity)]
 pub struct Breakpoint {
 	loc: ExprLocation,
 	collected: RefCell<HashMap<usize, (usize, Vec<Result<Val>>)>>,
@@ -254,7 +255,7 @@
 		ro_map.get(name).map(|value| value.source_code.clone())
 	}
 	pub fn map_source_locations(&self, file: &Path, locs: &[usize]) -> Vec<CodeLocation> {
-		offset_to_location(&self.get_source(file).unwrap_or("".into()), locs)
+		offset_to_location(&self.get_source(file).unwrap_or_else(|| "".into()), locs)
 	}
 	pub fn map_from_source_location(
 		&self,
@@ -396,7 +397,7 @@
 			data.stack_generation += 1;
 			result = data
 				.breakpoints
-				.insert(data.stack_depth, data.stack_generation, &e, result);
+				.insert(data.stack_depth, data.stack_generation, e, result);
 		}
 		if let Err(mut err) = result {
 			err.trace_mut().0.push(StackTraceElement {
@@ -486,7 +487,7 @@
 	pub fn manifest(&self, val: Val) -> Result<IStr> {
 		self.run_in_state(|| {
 			push_description_frame(
-				|| format!("manifestification"),
+				|| "manifestification".to_string(),
 				|| val.manifest(&self.manifest_format()),
 			)
 		})
@@ -640,8 +641,8 @@
 }
 
 pub fn cc_ptr_eq<T>(a: &Cc<T>, b: &Cc<T>) -> bool {
-	let a = &a as &T;
-	let b = &b as &T;
+	let a = a as &T;
+	let b = b as &T;
 	std::ptr::eq(a, b)
 }
 
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -123,7 +123,7 @@
 			}
 		}
 		for (name, member) in self.0.this_entries.iter() {
-			if handler(name, &member) {
+			if handler(name, member) {
 				return true;
 			}
 		}