Skip to content

Commit

Permalink
clips
Browse files Browse the repository at this point in the history
  • Loading branch information
kali committed Sep 6, 2024
1 parent 182537d commit 002aff7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/src/model/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,16 +570,16 @@ where
}

/// generates a name for a new node in the model that will not conflict (by suffixing with a
/// dot and number)
/// dot and number)
pub fn unique_name<'n>(&self, prefix: impl Into<Cow<'n, str>>) -> Cow<'n, str> {
let prefix = prefix.into();
if self.nodes.iter().all(|n| n.name != &*prefix) {
if self.nodes.iter().all(|n| n.name != *prefix) {
return prefix;
}
for i in 1.. {
let s = format!("{prefix}.{i}");
if self.nodes.iter().all(|n| n.name != s) {
return Cow::Owned(s)
if self.nodes.iter().all(|n| n.name != s) {
return Cow::Owned(s);
}
}
unreachable!();
Expand Down
2 changes: 1 addition & 1 deletion core/src/model/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ where
inputs: &[OutletId],
) -> TractResult<TVec<OutletId>> {
let mut name = name.into();
if self.nodes.iter().any(|n| n.name == &*name) {
if self.nodes.iter().any(|n| n.name == *name) {
for i in 1.. {
let s = format!("{name}#{i}");
if self.nodes.iter().all(|n| n.name != s) {
Expand Down

0 comments on commit 002aff7

Please sign in to comment.