warning: unused variable: `ctx`
--> programs/calculator-dapp/src/lib.rs:9:23
|
9 | pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
| ^^^ help: if this is intentional, prefix it with an underscore: `_ctx`
|
= note: `#[warn(unused_variables)]` on by default
1 Answer
A solution is in the warning message:
prefix it with an underscore: _ctx
For example:
pub fn initialize(_ctx: Context<Initialize>) -> Result<()> {
...
}
Generally, you'll use the context to access the accounts for your instructions, but the example above should get rid of the warning.