perf: improve call to `Path::ends_with`
`Path::ends_with` converts the comparator to a `Path` and compares all components.
`module_name` in `cached_path.path().ends_with(module_name)` is
guaranteed to be a single component so this overhead can be avoided.
```rust
#[must_use]
pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
self._ends_with(child.as_ref())
}
fn _ends_with(&self, child: &Path) -> bool {
iter_after(self.components().rev(), child.components().rev()).is_some()
}
```