Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    Besides the borrow checking error... how is this function ever going to return anything? It will just always return an empty vec. Is it just an incomplete simplified version of the actual function? Commented Nov 1, 2023 at 20:08
  • Correct... incomplete and simplified. I would be satisfied with an empty vec. Commented Nov 1, 2023 at 20:26
  • 1
    Ah ok, just checking. In any case, you can simply change the return type to Vec<String, MethodRouter> to perform a copy so the borrow checker is happy. Commented Nov 1, 2023 at 20:39
  • Marco -- I've edited the code to make the omission clear. Thanks! Commented Nov 1, 2023 at 20:47
  • 1
    Nitpick: It is more efficient to call entry.file_type().is_dir() than entry.path().is_dir() as this saves a syscall (usually). Commented Nov 2, 2023 at 9:30