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:
jussisaurio
2024-12-19 17:43:59 +02:00
6 changed files with 6 additions and 6 deletions

View File

@@ -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!(),
};

View File

@@ -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!(),
};

View File

@@ -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!(),
};

View File

@@ -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!(),
};

View File

@@ -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!(),
};

View File

@@ -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!(),
};