yihong0618 commented on code in PR #5554:
URL: https://github.com/apache/opendal/pull/5554#discussion_r1917759683


##########
core/src/raw/path.rs:
##########
@@ -157,7 +157,7 @@ pub fn get_basename(path: &str) -> &str {
     if !path.ends_with('/') {
         return path
             .split('/')
-            .last()
+            .next_back()

Review Comment:
   > I think I would rather go the other way around, warning about last when 
iterator implements DoubleEndedIterator. The problem with last is that it 
doesn't require DoubleEndedIterator to be implemented which means that in 
general case it's going to be slow, and while this can be dealt with manual 
implementation of that method, most iterators in standard library don't bother 
to do so. For those that do bother, I don't expect any particular difference 
between next_back and last even when the iterator is to be immediately dropped.
   
   
   more: https://github.com/rust-lang/rust-clippy/issues/1822



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to