- enable project wide compiler warnings - update documentation strings Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
44 lines
797 B
Rust
44 lines
797 B
Rust
/*
|
|
* advotracker - Hotline tackingtool for Advocats
|
|
*
|
|
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
|
* SPDX-License-Identifier: 0BSD, MIT
|
|
*/
|
|
|
|
#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]
|
|
|
|
//! advotrackerd: crate documentation
|
|
|
|
// This function adds two integers (given as arguments) and returns the sum.
|
|
//
|
|
// # Examples
|
|
//
|
|
// ```
|
|
// assert_eq!(8, advotrackerd::internal_adder(4, 4));
|
|
// ```
|
|
fn internal_adder(a: i32, b: i32) -> i32 {
|
|
a + b
|
|
}
|
|
|
|
/// This function adds two to its argument.
|
|
///
|
|
/// # Examples
|
|
///
|
|
/// ```
|
|
/// assert_eq!(4, advotrackerd::add_two(2));
|
|
/// ```
|
|
pub fn add_two(a: i32) -> i32 {
|
|
internal_adder(a, 2)
|
|
}
|
|
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn internal_test() {
|
|
assert_eq!(8, internal_adder(4, 4));
|
|
}
|
|
}
|