mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 21:32:15 +08:00
14 lines
206 B
Rust
14 lines
206 B
Rust
|
/// Adds one to the number given.
|
||
|
///
|
||
|
/// # Examples
|
||
|
///
|
||
|
/// ```
|
||
|
/// let arg = 5;
|
||
|
/// let answer = my_crate::add_one(arg);
|
||
|
///
|
||
|
/// assert_eq!(6, answer);
|
||
|
/// ```
|
||
|
pub fn add_one(x: i32) -> i32 {
|
||
|
x + 1
|
||
|
}
|