Use if-let guards in the codebase
This commit is contained in:
@@ -86,13 +86,12 @@ crate fn mod_dir_path(
|
||||
inline: Inline,
|
||||
) -> (PathBuf, DirOwnership) {
|
||||
match inline {
|
||||
Inline::Yes if let Some(file_path) = mod_file_path_from_attr(sess, attrs, &module.dir_path) => {
|
||||
// For inline modules file path from `#[path]` is actually the directory path
|
||||
// for historical reasons, so we don't pop the last segment here.
|
||||
(file_path, DirOwnership::Owned { relative: None })
|
||||
}
|
||||
Inline::Yes => {
|
||||
if let Some(file_path) = mod_file_path_from_attr(sess, attrs, &module.dir_path) {
|
||||
// For inline modules file path from `#[path]` is actually the directory path
|
||||
// for historical reasons, so we don't pop the last segment here.
|
||||
return (file_path, DirOwnership::Owned { relative: None });
|
||||
}
|
||||
|
||||
// We have to push on the current module name in the case of relative
|
||||
// paths in order to ensure that any additional module paths from inline
|
||||
// `mod x { ... }` come after the relative extension.
|
||||
|
||||
Reference in New Issue
Block a user