Adopt let else in more places
This commit is contained in:
parent
b8c56fa8c3
commit
2ef8af6619
132 changed files with 539 additions and 881 deletions
|
@ -368,9 +368,8 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
|
|||
fn check_item(&mut self, item_id: LocalDefId, item_span: Span) {
|
||||
let def_path_hash = self.tcx.def_path_hash(item_id.to_def_id());
|
||||
for attr in self.tcx.get_attrs(item_id.to_def_id()).iter() {
|
||||
let assertion = match self.assertion_maybe(item_id, attr) {
|
||||
Some(a) => a,
|
||||
None => continue,
|
||||
let Some(assertion) = self.assertion_maybe(item_id, attr) else {
|
||||
continue;
|
||||
};
|
||||
self.checked_attrs.insert(attr.id);
|
||||
for label in assertion.clean {
|
||||
|
|
|
@ -421,9 +421,8 @@ fn copy_files(sess: &Session, target_dir: &Path, source_dir: &Path) -> Result<bo
|
|||
return Err(());
|
||||
};
|
||||
|
||||
let source_dir_iterator = match source_dir.read_dir() {
|
||||
Ok(it) => it,
|
||||
Err(_) => return Err(()),
|
||||
let Ok(source_dir_iterator) = source_dir.read_dir() else {
|
||||
return Err(());
|
||||
};
|
||||
|
||||
let mut files_linked = 0;
|
||||
|
@ -700,12 +699,9 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
|
|||
let mut lock_files = FxHashSet::default();
|
||||
|
||||
for dir_entry in crate_directory.read_dir()? {
|
||||
let dir_entry = match dir_entry {
|
||||
Ok(dir_entry) => dir_entry,
|
||||
_ => {
|
||||
// Ignore any errors
|
||||
continue;
|
||||
}
|
||||
let Ok(dir_entry) = dir_entry else {
|
||||
// Ignore any errors
|
||||
continue;
|
||||
};
|
||||
|
||||
let entry_name = dir_entry.file_name();
|
||||
|
@ -740,16 +736,13 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
|
|||
// be some kind of leftover
|
||||
for (lock_file_name, directory_name) in &lock_file_to_session_dir {
|
||||
if directory_name.is_none() {
|
||||
let timestamp = match extract_timestamp_from_session_dir(lock_file_name) {
|
||||
Ok(timestamp) => timestamp,
|
||||
Err(()) => {
|
||||
debug!(
|
||||
"found lock-file with malformed timestamp: {}",
|
||||
crate_directory.join(&lock_file_name).display()
|
||||
);
|
||||
// Ignore it
|
||||
continue;
|
||||
}
|
||||
let Ok(timestamp) = extract_timestamp_from_session_dir(lock_file_name) else {
|
||||
debug!(
|
||||
"found lock-file with malformed timestamp: {}",
|
||||
crate_directory.join(&lock_file_name).display()
|
||||
);
|
||||
// Ignore it
|
||||
continue;
|
||||
};
|
||||
|
||||
let lock_file_path = crate_directory.join(&**lock_file_name);
|
||||
|
@ -798,16 +791,13 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
|
|||
for (lock_file_name, directory_name) in &lock_file_to_session_dir {
|
||||
debug!("garbage_collect_session_directories() - inspecting: {}", directory_name);
|
||||
|
||||
let timestamp = match extract_timestamp_from_session_dir(directory_name) {
|
||||
Ok(timestamp) => timestamp,
|
||||
Err(()) => {
|
||||
debug!(
|
||||
"found session-dir with malformed timestamp: {}",
|
||||
crate_directory.join(directory_name).display()
|
||||
);
|
||||
// Ignore it
|
||||
continue;
|
||||
}
|
||||
let Ok(timestamp) = extract_timestamp_from_session_dir(directory_name) else {
|
||||
debug!(
|
||||
"found session-dir with malformed timestamp: {}",
|
||||
crate_directory.join(directory_name).display()
|
||||
);
|
||||
// Ignore it
|
||||
continue;
|
||||
};
|
||||
|
||||
if is_finalized(directory_name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue