_14_longest_common_prefix.rs: linting with clippy
shadiakiki1986 opened this issue · 1 comments
shadiakiki1986 commented
In _14_longest_common_prefix.rs, running cargo clippy
suggests:
- replacing
if strs.len() < 1
withif strs.is_empty()
- replacing
curr_char.take().map(|ch| prefix.push(ch));
withif let Some(ch) = curr_char.take() { prefix.push(ch) };
It's not only a matter of linting, but also educational for the if let
style in rust which is not available in other popular languages like python.
shadiakiki1986 commented
Actually never mind me. I missed that the version in the repo is different than the one published at https://beta.rustgym.com/longest-common-prefix/
Maybe the published article needs to be updated? Or add a link to the github src?