Skip to content

Commit d9e0ad7

Browse files
committed
Clippy: Fix
1 parent 3611825 commit d9e0ad7

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

simplicity-sys/src/alloc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::mem;
77
/// [16 bytes is the greatest alignment of any architecture Rust currently supports](https://github.com/rust-lang/rust/blob/61223975d46f794466efa832bc7562b9707ecc46/library/std/src/sys/pal/common/alloc.rs).
88
#[repr(align(16))]
99
#[derive(Default, Copy, Clone)]
10+
#[allow(dead_code)]
1011
pub struct AlignedType([u8; 16]);
1112

1213
/// Minimal alignment which is valid for all C types.

src/human_encoding/parse/mod.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,10 @@ pub fn parse<J: Jet + 'static>(
431431
for data in expr.as_ref().post_order_iter::<InternalSharing>() {
432432
let left = data
433433
.left_index
434-
.and_then(|idx| converted[idx].as_ref().map(Arc::clone));
434+
.and_then(|idx| Option::<Arc<_>>::clone(&converted[idx]));
435435
let right = data
436436
.right_index
437-
.and_then(|idx| converted[idx].as_ref().map(Arc::clone));
437+
.and_then(|idx| Option::<Arc<_>>::clone(&converted[idx]));
438438

439439
let maybe_inner = match data.node.inner {
440440
ResolvedInner::Missing { ref name, .. } => {
@@ -482,11 +482,7 @@ pub fn parse<J: Jet + 'static>(
482482
}
483483
};
484484

485-
let name = data
486-
.node
487-
.name
488-
.as_ref()
489-
.map(Arc::clone)
485+
let name = Option::<Arc<str>>::clone(&data.node.name)
490486
.unwrap_or_else(|| Arc::from(namer.assign_name(inner.as_ref()).as_str()));
491487

492488
let node = NamedConstructNode::new(

src/node/witness.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<J: Jet> WitnessNode<J> {
5959
.as_ref()
6060
.map(Arc::clone)
6161
.map_disconnect(Option::<Arc<_>>::clone)
62-
.map_witness(|wit| wit.as_ref().map(Arc::clone)),
62+
.map_witness(Option::<Arc<Value>>::clone),
6363
})
6464
}
6565

@@ -83,7 +83,7 @@ impl<J: Jet> WitnessNode<J> {
8383
_: &PostOrderIterItem<&WitnessNode<J>>,
8484
wit: &Option<Arc<Value>>,
8585
) -> Result<Option<Arc<Value>>, Self::Error> {
86-
Ok(wit.as_ref().map(Arc::clone))
86+
Ok(Option::<Arc<Value>>::clone(wit))
8787
}
8888

8989
fn prune_case(
@@ -129,7 +129,7 @@ impl<J: Jet> WitnessNode<J> {
129129
) -> Result<WitnessData<J>, Self::Error> {
130130
let converted_inner = inner
131131
.map(|node| node.cached_data())
132-
.map_witness(|wit| wit.as_ref().map(Arc::clone));
132+
.map_witness(Option::<Arc<Value>>::clone);
133133
// This next line does the actual retyping.
134134
let mut retyped = WitnessData::from_inner(converted_inner)?;
135135
// Sometimes we set the prune bit on nodes without setting that

0 commit comments

Comments
 (0)