Skip to content

Commit

Permalink
lang/syn: Allow state structs with no ctor or impl block
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante committed Feb 10, 2021
1 parent 845df6d commit a780002
Show file tree
Hide file tree
Showing 6 changed files with 589 additions and 538 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ incremented for features.
* cli: Stream program logs to `.anchor/program-logs` directory when testing.
* spl: Add shared memory api.
* lang/attribute/access-control: Allow specifying multiple modifier functions.
* lang/syn: Allow state structs that don't have a ctor or impl block (just trait implementations).

## [0.2.0] - 2021-02-08

Expand Down
10 changes: 1 addition & 9 deletions examples/interface/programs/counter-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@ pub mod counter_auth {
use super::*;

#[state]
pub struct CounterAuth {}

// TODO: remove this impl block after addressing
// https://github.com/project-serum/anchor/issues/71.
impl CounterAuth {
pub fn new(_ctx: Context<Empty>) -> Result<Self, ProgramError> {
Ok(Self {})
}
}
pub struct CounterAuth;

impl<'info> Auth<'info, Empty> for CounterAuth {
fn is_authorized(_ctx: Context<Empty>, current: u64, new: u64) -> ProgramResult {
Expand Down

0 comments on commit a780002

Please sign in to comment.