mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-06 01:53:30 +02:00
Require a main function in all exercises
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
pub fn generate_nametag_text(name: String) -> Option<String> {
|
||||
if name.is_empty() {
|
||||
// Empty names aren't allowed.
|
||||
|
||||
@@ -29,6 +29,10 @@ pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
|
||||
Ok(qty * cost_per_item + processing_fee)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -19,6 +19,10 @@ impl PositiveNonzeroInteger {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_creation() {
|
||||
assert!(PositiveNonzeroInteger::new(10).is_ok());
|
||||
|
||||
@@ -54,6 +54,10 @@ impl PositiveNonzeroInteger {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user