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

lang: the Err-variant returned from this function is very large #2599

Closed
wjthieme opened this issue Aug 12, 2023 · 0 comments · Fixed by #2600
Closed

lang: the Err-variant returned from this function is very large #2599

wjthieme opened this issue Aug 12, 2023 · 0 comments · Fixed by #2600
Labels

Comments

@wjthieme
Copy link
Contributor

wjthieme commented Aug 12, 2023

Clippy added a new rule in 1.65.0 related to the size or Err variant on Result. This is rule fails for anchor_lang::error::Error which makes anchor_lang::prelude::Result fail Clippy checks.

41 |     pub fn transfer_hook(ctx: Context<Transfer>, amount: u64) -> Result<()> {
   |                                                                  ^^^^^^^^^^ the `Err`-variant is at least 160 bytes
   |
   = help: try reducing the size of `anchor_lang::error::Error`, for example by boxing large elements or replacing it with `Box<anchor_lang::error::Error>`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err

env

rustc 1.71.0 (8ede3aae2 2023-07-12)
solana-cli 1.14.24 (src:605da4a3; feat:1879391783)
anchor-cli 0.28.0

deps

anchor-lang = { version = "^0.28.0", features = ["init-if-needed"] }
anchor-spl = { version = "^0.28.0" }
@wjthieme wjthieme changed the title The Err-variant returned from this function is very large lang: the Err-variant returned from this function is very large Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants