Skip to content
Myr

Use next_back() instead of last()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes a new Clippy warning.

authored by Tavian Barnes · committed by Tavian Barnes · parent 16b4671 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:src/dir_entry.rs+1 added-1 removed
135 unmodified lines
136 // Path::file_name() only works if the last component is Normal,137 // but we want it for all component types, so we open code it.138 // Copied from LsColors::style_for_path_with_metadata().139 path.components()140 .last()140 .next_back()141 .map(|c| c.as_os_str())142 .unwrap_or_else(|| path.as_os_str())143 }144 };
11 unmodified lines