Require a main function in all exercises

This commit is contained in:
mo8it
2024-04-17 22:46:21 +02:00
parent d83cc69afe
commit cb9f1ac9ce
39 changed files with 199 additions and 44 deletions
+4
View File
@@ -10,6 +10,10 @@
// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a
// hint.
fn main() {
// You can optionally experiment here.
}
#[cfg(test)]
mod tests {
#[test]
+4
View File
@@ -6,6 +6,10 @@
// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a
// hint.
fn main() {
// You can optionally experiment here.
}
#[cfg(test)]
mod tests {
#[test]
+4
View File
@@ -11,6 +11,10 @@ pub fn is_even(num: i32) -> bool {
num % 2 == 0
}
fn main() {
// You can optionally experiment here.
}
#[cfg(test)]
mod tests {
use super::*;
+6 -2
View File
@@ -7,7 +7,7 @@
struct Rectangle {
width: i32,
height: i32
height: i32,
}
impl Rectangle {
@@ -16,10 +16,14 @@ impl Rectangle {
if width <= 0 || height <= 0 {
panic!("Rectangle width and height cannot be negative!")
}
Rectangle {width, height}
Rectangle { width, height }
}
}
fn main() {
// You can optionally experiment here.
}
#[cfg(test)]
mod tests {
use super::*;