docs: make mention of modules section & run rustfmt

This commit is contained in:
rzmk 2023-09-21 08:02:55 -04:00
parent 98f459c747
commit 3673f6df8e
No known key found for this signature in database
2 changed files with 10 additions and 8 deletions

View file

@ -1,9 +1,11 @@
//! # ladderz //! # ladderz
//! //!
//! Implementations of mathematical and technical concepts in Rust. //! Implementations of mathematical and technical concepts in Rust.
//! //!
//! View [the modules section](#modules) for the various implementations based on the subject.
//!
//! # Example //! # Example
//! //!
//! Here's an example of using the `ladderz` crate to get the factors and factor pairs of a number in sorted order. //! Here's an example of using the `ladderz` crate to get the factors and factor pairs of a number in sorted order.
//! We'll assume you're using Bash as your terminal. //! We'll assume you're using Bash as your terminal.
//! //!

View file

@ -149,13 +149,13 @@ pub fn is_factor(x: u32, y: u32) -> bool {
} }
/// Checks if a positive integer `x` is a multiple of another positive integer `y`. /// Checks if a positive integer `x` is a multiple of another positive integer `y`.
/// ///
/// # Challenge /// # Challenge
/// ///
/// Write a program that determines whether one positive integer is a multiple of another. /// Write a program that determines whether one positive integer is a multiple of another.
/// ///
/// # Description /// # Description
/// ///
/// Checks if a positive integer `x` is a multiple of another positive integer `y`. /// Checks if a positive integer `x` is a multiple of another positive integer `y`.
/// ///
/// A multiple of `y` is a positive integer `x` where `x` is evenly divisible by `y` (i.e., `x % y == 0`). /// A multiple of `y` is a positive integer `x` where `x` is evenly divisible by `y` (i.e., `x % y == 0`).
@ -223,7 +223,7 @@ pub fn is_multiple(x: u32, y: u32) -> bool {
pub fn get_multiples_in_range(n: u32, end: u32) -> HashSet<u32> { pub fn get_multiples_in_range(n: u32, end: u32) -> HashSet<u32> {
let mut multiples: HashSet<u32> = HashSet::new(); let mut multiples: HashSet<u32> = HashSet::new();
for num in n..end+1 { for num in n..end + 1 {
if num % n == 0 { if num % n == 0 {
multiples.insert(num); multiples.insert(num);
} }
@ -264,7 +264,7 @@ mod tests {
assert_eq!(result, expected); assert_eq!(result, expected);
let result_2: bool = false; let result_2: bool = false;
let expected_2: bool = is_factor(3, 10); let expected_2: bool = is_factor(3, 10);
assert_eq!(result_2, expected_2); assert_eq!(result_2, expected_2);
} }