This commit is contained in:
sxyazi 2025-02-09 14:28:37 +08:00
parent 36a40987ba
commit fe679d6f8b
No known key found for this signature in database
2 changed files with 2 additions and 6 deletions

View file

@ -81,9 +81,9 @@ impl Adapter {
impl Adapter {
pub fn matches(emulator: Emulator) -> Self {
if matches!(emulator.kind.left(), Some(Brand::Microsoft)) {
if emulator.kind.is_left_and(|&b| b == Brand::Microsoft) {
return Self::Sixel;
} else if WSL.get() && matches!(emulator.kind.left(), Some(Brand::WezTerm)) {
} else if WSL.get() && emulator.kind.is_left_and(|&b| b == Brand::WezTerm) {
return Self::KgpOld;
}

View file

@ -33,10 +33,6 @@ impl<L, R> Either<L, R> {
}
}
pub fn is_left(&self) -> bool { matches!(self, Either::Left(_)) }
pub fn is_right(&self) -> bool { matches!(self, Either::Right(_)) }
pub fn is_left_and<F: FnOnce(&L) -> bool>(&self, f: F) -> bool {
self.left().map(f).unwrap_or(false)
}