Skip to content

Commit

Permalink
Sway Reference: Section 9 annotations: allow dead code (FuelLabs#4624)
Browse files Browse the repository at this point in the history
  • Loading branch information
Braqzen authored Jun 6, 2023
1 parent e60f54f commit 6e7b971
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/reference/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- [Storage](./documentation/language/annotations/attributes/storage.md)
- [Payable](./documentation/language/annotations/attributes/payable.md)
- [Test](./documentation/language/annotations/attributes/test.md)
- [Allow](./documentation/language/annotations/attributes/allow.md)
- [Inline](./documentation/language/annotations/attributes/inline.md)
- [Traits](./documentation/language/traits/index.md)
- [Generics](./documentation/language/generics/index.md)
Expand Down
5 changes: 5 additions & 0 deletions docs/reference/src/code/language/annotations/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ abi MyContract {
// ANCHOR_END: payable
}

// ANCHOR: allow_deadcode_annotation
#[allow(dead_code)]
fn unused_function() {}
// ANCHOR_END: allow_deadcode_annotation

// ANCHOR: success_test
#[test]
fn equal() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Allow

## Dead code

The `#[allow(dead_code)]` annotation disables warnings which are emitted by the compiler for code that is unused.

```sway
{{#include ../../../../code/language/annotations/src/main.sw:allow_deadcode_annotation}}
```

0 comments on commit 6e7b971

Please sign in to comment.