Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deref trait abuse #2

Open
ErnWong opened this issue Jun 8, 2021 · 2 comments
Open

Remove deref trait abuse #2

ErnWong opened this issue Jun 8, 2021 · 2 comments

Comments

@ErnWong
Copy link
Owner

ErnWong commented Jun 8, 2021

E.g.

crystalorb/src/timestamp.rs

Lines 261 to 272 in 6159018

impl<T> Deref for Timestamped<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl<T> DerefMut for Timestamped<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}

There are probably other cases.

@smokku
Copy link

smokku commented Jun 19, 2021

Is there a reasoning for it?
(besides it is seen as bad practice)

@ErnWong
Copy link
Owner Author

ErnWong commented Jun 19, 2021

Not really. It's not really blocking any particular use-case or causing any headaches (yet), but it might be good to get the semantics "right".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants