warycat/rustgym

_14_longest_common_prefix.rs: linting with clippy

shadiakiki1986 opened this issue · 1 comments

In _14_longest_common_prefix.rs, running cargo clippy suggests:

  • replacing if strs.len() < 1 with if strs.is_empty()
  • replacing curr_char.take().map(|ch| prefix.push(ch)); with if 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.

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?