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

[Dev] want to improve storage mod about IntoSuper code #3529

Open
nkysg opened this issue Jul 13, 2022 · 1 comment
Open

[Dev] want to improve storage mod about IntoSuper code #3529

nkysg opened this issue Jul 13, 2022 · 1 comment
Labels
enhancement Enhancement help wanted Extra attention is needed

Comments

@nkysg
Copy link
Collaborator

nkysg commented Jul 13, 2022

May be we can get a better code. Is it possible to refactor these code?
** Related Code **

starcoin/storage/src/lib.rs

Lines 612 to 625 in 6c0546e

impl<'a, T: 'a + StateNodeStore> IntoSuper<dyn StateNodeStore + 'a> for T {
fn as_super(&self) -> &(dyn StateNodeStore + 'a) {
self
}
fn as_super_mut(&mut self) -> &mut (dyn StateNodeStore + 'a) {
self
}
fn into_super(self: Box<Self>) -> Box<dyn StateNodeStore + 'a> {
self
}
fn into_super_arc(self: Arc<Self>) -> Arc<dyn StateNodeStore + 'a> {
self
}
}

@nkysg nkysg added the enhancement Enhancement label Jul 13, 2022
@nkysg nkysg changed the title [Dev] want to remove storage mod IntoSuper code [Dev] want to improve storage mod IntoSuper code Jul 13, 2022
@nkysg nkysg added the help wanted Extra attention is needed label Jul 13, 2022
@nkysg nkysg changed the title [Dev] want to improve storage mod IntoSuper code [Dev] want to improve storage mod about IntoSuper code Jul 13, 2022
@nkysg
Copy link
Collaborator Author

nkysg commented Jul 22, 2022

rust-lang/rust#65991, may be we could use trait_upcasting in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant