mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-28 21:44:21 +01:00
Merge 'cleanup: replace &(*x) with x.as_ref() for smart pointer derefs' from Ziyak Jehangir
The only instances of the &(*x) dereferencing pattern in the codebase, is used with Completion smart pointers. Changed it to use as_ref(). No functional changes. Closes #516
This commit is contained in:
@@ -267,7 +267,7 @@ impl DatabaseStorage {
|
||||
|
||||
impl limbo_core::DatabaseStorage for DatabaseStorage {
|
||||
fn read_page(&self, page_idx: usize, c: Rc<limbo_core::Completion>) -> Result<()> {
|
||||
let r = match &(*c) {
|
||||
let r = match c.as_ref() {
|
||||
limbo_core::Completion::Read(r) => r,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -190,7 +190,7 @@ impl File for DarwinFile {
|
||||
fn pread(&self, pos: usize, c: Rc<Completion>) -> Result<()> {
|
||||
let file = self.file.borrow();
|
||||
let result = {
|
||||
let r = match &(*c) {
|
||||
let r = match c.as_ref() {
|
||||
Completion::Read(r) => r,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ impl File for GenericFile {
|
||||
let mut file = self.file.borrow_mut();
|
||||
file.seek(std::io::SeekFrom::Start(pos as u64))?;
|
||||
{
|
||||
let r = match &(*c) {
|
||||
let r = match c.as_ref() {
|
||||
Completion::Read(r) => r,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -241,7 +241,7 @@ impl File for LinuxFile {
|
||||
}
|
||||
|
||||
fn pread(&self, pos: usize, c: Rc<Completion>) -> Result<()> {
|
||||
let r = match &(*c) {
|
||||
let r = match c.as_ref() {
|
||||
Completion::Read(r) => r,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ impl File for WindowsFile {
|
||||
let mut file = self.file.borrow_mut();
|
||||
file.seek(std::io::SeekFrom::Start(pos as u64))?;
|
||||
{
|
||||
let r = match &(*c) {
|
||||
let r = match c.as_ref() {
|
||||
Completion::Read(r) => r,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ pub struct FileStorage {
|
||||
#[cfg(feature = "fs")]
|
||||
impl DatabaseStorage for FileStorage {
|
||||
fn read_page(&self, page_idx: usize, c: Rc<Completion>) -> Result<()> {
|
||||
let r = match &(*c) {
|
||||
let r = match c.as_ref() {
|
||||
Completion::Read(r) => r,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user