Lint layout_2020 with clippy (#31169)

cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
This commit is contained in:
Oriol Brufau 2024-01-25 10:03:31 +01:00 committed by GitHub
parent 886f6c58d4
commit 50f56affe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 224 additions and 244 deletions

View file

@ -50,7 +50,7 @@ impl Table {
/// Return the slot at the given coordinates, if it exists in the table, otherwise
/// return None.
fn get_slot<'a>(&'a self, coords: TableSlotCoordinates) -> Option<&'a TableSlot> {
fn get_slot(&self, coords: TableSlotCoordinates) -> Option<&TableSlot> {
self.slots.get(coords.y)?.get(coords.x)
}
@ -60,8 +60,8 @@ impl Table {
) -> Option<TableSlotCoordinates> {
match self.get_slot(coords) {
Some(&TableSlot::Cell(_)) => Some(coords),
Some(&TableSlot::Spanned(ref offsets)) => Some(coords - offsets[0]),
_ => return None,
Some(TableSlot::Spanned(offsets)) => Some(coords - offsets[0]),
_ => None,
}
}
@ -73,7 +73,7 @@ impl Table {
let slot = self.get_slot(resolved_coords);
match slot {
Some(&TableSlot::Cell(ref cell)) => Some(cell),
Some(TableSlot::Cell(cell)) => Some(cell),
_ => unreachable!(
"Spanned slot should not point to an empty cell or another spanned slot."
),