Skip to content

Commit 0f77b7b

Browse files
committed
clippy fix
1 parent 722896c commit 0f77b7b

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

hugr-persistent/src/commit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a> Commit<'a> {
7676
pub(crate) fn new_base(hugr: Hugr, state_space: &'a CommitStateSpace) -> Self {
7777
let commit = RelRc::new(CommitData::Base(hugr));
7878
commit
79-
.try_register_in(&state_space.as_registry())
79+
.try_register_in(state_space.as_registry())
8080
.expect("new node is not yet registered");
8181

8282
Commit(commit, PhantomData)
@@ -119,7 +119,7 @@ impl<'a> Commit<'a> {
119119
return Err(InvalidCommit::NonUniqueBase(err.count()));
120120
}
121121

122-
rc.try_register_in(&state_space.as_registry())
122+
rc.try_register_in(state_space.as_registry())
123123
.expect("new node is not yet registered");
124124

125125
Ok(Self(rc, PhantomData))

hugr-persistent/src/commit/boundary.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ impl Commit<'_> {
5959
return_invalid: BoundaryMode,
6060
) -> impl Iterator<Item = (PatchNode, IncomingPort)> + '_ {
6161
assert!(
62-
self.has_boundary_edge_into(node, port, &child),
62+
self.has_boundary_edge_into(node, port, child),
6363
"not a boundary edge"
6464
);
6565

66-
let parent_hugrs = ParentsView::from_commit(&child);
66+
let parent_hugrs = ParentsView::from_commit(child);
6767
let repl = child.replacement().expect("valid child commit");
6868
let child_id = child.id();
6969
repl.linked_replacement_inputs(
@@ -100,7 +100,7 @@ impl Commit<'_> {
100100
child: &Commit,
101101
return_invalid: BoundaryMode,
102102
) -> Option<(PatchNode, OutgoingPort)> {
103-
let parent_hugrs = ParentsView::from_commit(&child);
103+
let parent_hugrs = ParentsView::from_commit(child);
104104
let repl = child.replacement()?;
105105
match repl.linked_replacement_output(
106106
(self.to_patch_node(node), port),

hugr-persistent/src/state_space.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl From<Registry<CommitData, ()>> for CommitStateSpace {
103103

104104
impl From<Rc<RefCell<Registry<CommitData, ()>>>> for CommitStateSpace {
105105
fn from(registry: Rc<RefCell<Registry<CommitData, ()>>>) -> Self {
106-
Self { registry: registry }
106+
Self { registry }
107107
}
108108
}
109109

@@ -114,6 +114,12 @@ impl<'a> From<&'a Rc<RefCell<Registry<CommitData, ()>>>> for &'a CommitStateSpac
114114
}
115115
}
116116

117+
impl Default for CommitStateSpace {
118+
fn default() -> Self {
119+
Self::new()
120+
}
121+
}
122+
117123
impl CommitStateSpace {
118124
/// Create a new empty commit state space.
119125
pub fn new() -> Self {
@@ -129,7 +135,7 @@ impl CommitStateSpace {
129135
if !self.registry.borrow().is_empty() {
130136
return None;
131137
}
132-
Some(Commit::new_base(hugr, &self))
138+
Some(Commit::new_base(hugr, self))
133139
}
134140

135141
/// Check if `commit` is in the commit state space.

0 commit comments

Comments
 (0)