Skip to content

Commit a4dcd1f

Browse files
committed
Add an example for outer attributes
1 parent 99f36b1 commit a4dcd1f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/attributes.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Attributes may be applied to many things in the language:
4949
* [Match expression arms][match expressions] accept outer attributes.
5050
* [Generic lifetime or type parameter][generics] accept outer attributes.
5151

52-
An example of attributes:
52+
Some examples of attributes:
5353

5454
```rust
5555
// General metadata applied to the enclosing module or crate.
@@ -70,6 +70,15 @@ mod bar {
7070
// A lint attribute used to suppress a warning/error
7171
#[allow(non_camel_case_types)]
7272
type int8_t = i8;
73+
74+
// Outer attribute applies to the entire function.
75+
fn some_unused_variables() {
76+
#![allow(unused_variables)]
77+
78+
let x = ();
79+
let y = ();
80+
let z = ();
81+
}
7382
```
7483

7584
The rest of this page describes or links to descriptions of which attribute

0 commit comments

Comments
 (0)