Skip to content

Commit

Permalink
Merge 'cleanup: replace &(*x) with x.as_ref() for smart pointer deref…
Browse files Browse the repository at this point in the history
…s' 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
  • Loading branch information
jussisaurio committed Dec 19, 2024
2 parents 91a5994 + 99d1b0e commit acdfe2b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bindings/wasm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand Down
2 changes: 1 addition & 1 deletion core/io/darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand Down
2 changes: 1 addition & 1 deletion core/io/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand Down
2 changes: 1 addition & 1 deletion core/io/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand Down
2 changes: 1 addition & 1 deletion core/io/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand Down
2 changes: 1 addition & 1 deletion core/storage/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand Down

0 comments on commit acdfe2b

Please sign in to comment.