Skip to content

Commit 99812ab

Browse files
committed
Fix clippy "warning: called Iterator::last on a DoubleEndedIterator" lint
Fixing this because (quoting the clippy warning) "this will needlessly iterate the entire iterator".
1 parent bfe122c commit 99812ab

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn walk_entity_dir(
170170
// only base name for all nodes regardless of depth if compose-node-name isn't
171171
// enabled.
172172
(
173-
cls.split(MAIN_SEPARATOR).last().ok_or(anyhow!(
173+
cls.split(MAIN_SEPARATOR).next_back().ok_or(anyhow!(
174174
"Can't shorten node name for {}",
175175
entry.path().display()
176176
))?,

src/node/nodeinfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl NodeInfoMeta {
7373
vec![self
7474
.parts
7575
.iter()
76-
.last()
76+
.next_back()
7777
.ok_or(anyhow!("Unable to extract last segment from node"))?
7878
.to_str()
7979
.ok_or(anyhow!("Unable to convert path segment to a string"))?]

0 commit comments

Comments
 (0)