Skip to content

Commit 38212ab

Browse files
committed
fix: avoid let-chains in stable-buildable crates
1 parent c417c1d commit 38212ab

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

crates/cuda_builder/src/lib.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,12 @@ fn find_in_dir(dir: &Path, filename: &str) -> Option<PathBuf> {
469469
continue;
470470
}
471471

472-
if let Some(name) = path.file_name().and_then(|s| s.to_str())
473-
&& (name == filename
474-
|| (name.starts_with(&hashed_prefix) && name.ends_with(dll_suffix)))
475-
{
476-
return Some(path);
472+
if let Some(name) = path.file_name().and_then(|s| s.to_str()) {
473+
if name == filename
474+
|| (name.starts_with(&hashed_prefix) && name.ends_with(dll_suffix))
475+
{
476+
return Some(path);
477+
}
477478
}
478479
}
479480
}
@@ -586,11 +587,12 @@ fn workspace_root_dir() -> Option<PathBuf> {
586587

587588
loop {
588589
let candidate = path.join("Cargo.toml");
589-
if candidate.is_file()
590-
&& let Ok(contents) = fs::read_to_string(&candidate)
591-
&& contents.contains("[workspace]")
592-
{
593-
return Some(path.clone());
590+
if candidate.is_file() {
591+
if let Ok(contents) = fs::read_to_string(&candidate) {
592+
if contents.contains("[workspace]") {
593+
return Some(path.clone());
594+
}
595+
}
594596
}
595597

596598
if !path.pop() {

crates/ptx/src/lexer.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,14 @@ impl<'src> Lexer<'src> {
440440
let cur = self.cur;
441441
let ident = self.eat_until(|c, _| is_ident_continue(c));
442442
// check if its an instruction
443-
if ident.chars().all(|c| c.is_ascii_alphanumeric())
444-
&& let Ok(kind) = InstructionKind::from_str(ident.as_str())
445-
{
446-
*self.values.last_mut().unwrap() = Some(TokenValue::Instruction(kind));
447-
return Token {
448-
kind: TokenKind::Instruction,
449-
range: cur..self.cur,
450-
};
443+
if ident.chars().all(|c| c.is_ascii_alphanumeric()) {
444+
if let Ok(kind) = InstructionKind::from_str(ident.as_str()) {
445+
*self.values.last_mut().unwrap() = Some(TokenValue::Instruction(kind));
446+
return Token {
447+
kind: TokenKind::Instruction,
448+
range: cur..self.cur,
449+
};
450+
}
451451
}
452452

453453
*self.values.last_mut().unwrap() =

0 commit comments

Comments
 (0)