Pure Programmer
Blue Matrix


Cluster Map

Project: Ordinal Date

Write a function to compute the ordinal date. The function should have arguments for month, day and year. Use preconditions to validate the function arguments and postconditions to check the result. There are two different ways to compute the ordinal date. One is to directly compute it using min() and max() (See [[Ordinal date]]). The other is to precompute the days prior to the beggining of a month and store the results in an array.

Output
$ rustc OrdinalDate1.rs error: unknown format trait `s` --> OrdinalDate1.rs:46:38 | 46 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!"))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:29 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:35 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:41 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:49 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:20:18 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:20:24 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 20 | let jan:isize = max(0,main(1,M - 1)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:21:18 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:21:24 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 21 | let feb:isize = max(0,main(1,M - 2)) * 28; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:22:18 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:22:24 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 22 | let mar:isize = max(0,main(1,M - 3)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:23:18 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ | help: a local variable with a similar name exists | 23 | let apr:isize = mar(0,min(1,M - 4)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:23:24 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 23 | let apr:isize = max(0,main(1,M - 4)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:24:18 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ | help: a local variable with a similar name exists | 24 | let may:isize = mar(0,min(1,M - 5)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:24:24 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 24 | let may:isize = max(0,main(1,M - 5)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:25:18 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ | help: a local variable with a similar name exists | 25 | let jun:isize = mar(0,min(1,M - 6)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:25:24 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 25 | let jun:isize = max(0,main(1,M - 6)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:26:18 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ | help: a local variable with a similar name exists | 26 | let jul:isize = mar(0,min(1,M - 7)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:26:24 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 26 | let jul:isize = max(0,main(1,M - 7)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:27:18 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ | help: a local variable with a similar name exists | 27 | let aug:isize = mar(0,min(1,M - 8)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:27:24 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 27 | let aug:isize = max(0,main(1,M - 8)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:28:18 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ | help: a local variable with a similar name exists | 28 | let sep:isize = mar(0,min(1,M - 9)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:28:24 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 28 | let sep:isize = max(0,main(1,M - 9)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:29:18 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ | help: a local variable with a similar name exists | 29 | let oct:isize = mar(0,min(1,M - 10)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:29:24 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 29 | let oct:isize = max(0,main(1,M - 10)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:30:18 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ | help: a local variable with a similar name exists | 30 | let nov:isize = mar(0,min(1,M - 11)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:30:24 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 30 | let nov:isize = max(0,main(1,M - 11)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:31:101 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ | help: a local variable with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * mar(0,min(1,M - 2)); | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:31:107 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,main(1,M - 2)); | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:41:5 | 41 | if args.len() == 4 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:42:11 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:42:33 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:43:9 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:43:31 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:44:10 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:44:32 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> OrdinalDate1.rs:47:3 | 47 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error: aborting due to 37 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc OrdinalDate1.rs error: unknown format trait `s` --> OrdinalDate1.rs:46:38 | 46 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!"))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:29 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:35 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:41 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:49 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:20:18 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:20:24 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 20 | let jan:isize = max(0,main(1,M - 1)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:21:18 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:21:24 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 21 | let feb:isize = max(0,main(1,M - 2)) * 28; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:22:18 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:22:24 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 22 | let mar:isize = max(0,main(1,M - 3)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:23:18 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ | help: a local variable with a similar name exists | 23 | let apr:isize = mar(0,min(1,M - 4)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:23:24 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 23 | let apr:isize = max(0,main(1,M - 4)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:24:18 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ | help: a local variable with a similar name exists | 24 | let may:isize = mar(0,min(1,M - 5)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:24:24 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 24 | let may:isize = max(0,main(1,M - 5)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:25:18 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ | help: a local variable with a similar name exists | 25 | let jun:isize = mar(0,min(1,M - 6)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:25:24 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 25 | let jun:isize = max(0,main(1,M - 6)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:26:18 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ | help: a local variable with a similar name exists | 26 | let jul:isize = mar(0,min(1,M - 7)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:26:24 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 26 | let jul:isize = max(0,main(1,M - 7)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:27:18 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ | help: a local variable with a similar name exists | 27 | let aug:isize = mar(0,min(1,M - 8)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:27:24 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 27 | let aug:isize = max(0,main(1,M - 8)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:28:18 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ | help: a local variable with a similar name exists | 28 | let sep:isize = mar(0,min(1,M - 9)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:28:24 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 28 | let sep:isize = max(0,main(1,M - 9)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:29:18 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ | help: a local variable with a similar name exists | 29 | let oct:isize = mar(0,min(1,M - 10)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:29:24 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 29 | let oct:isize = max(0,main(1,M - 10)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:30:18 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ | help: a local variable with a similar name exists | 30 | let nov:isize = mar(0,min(1,M - 11)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:30:24 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 30 | let nov:isize = max(0,main(1,M - 11)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:31:101 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ | help: a local variable with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * mar(0,min(1,M - 2)); | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:31:107 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,main(1,M - 2)); | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:41:5 | 41 | if args.len() == 4 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:42:11 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:42:33 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:43:9 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:43:31 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:44:10 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:44:32 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> OrdinalDate1.rs:47:3 | 47 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error: aborting due to 37 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc OrdinalDate1.rs error: unknown format trait `s` --> OrdinalDate1.rs:46:38 | 46 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!"))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:29 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:35 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:41 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:49 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:20:18 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:20:24 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 20 | let jan:isize = max(0,main(1,M - 1)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:21:18 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:21:24 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 21 | let feb:isize = max(0,main(1,M - 2)) * 28; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:22:18 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:22:24 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 22 | let mar:isize = max(0,main(1,M - 3)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:23:18 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ | help: a local variable with a similar name exists | 23 | let apr:isize = mar(0,min(1,M - 4)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:23:24 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 23 | let apr:isize = max(0,main(1,M - 4)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:24:18 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ | help: a local variable with a similar name exists | 24 | let may:isize = mar(0,min(1,M - 5)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:24:24 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 24 | let may:isize = max(0,main(1,M - 5)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:25:18 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ | help: a local variable with a similar name exists | 25 | let jun:isize = mar(0,min(1,M - 6)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:25:24 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 25 | let jun:isize = max(0,main(1,M - 6)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:26:18 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ | help: a local variable with a similar name exists | 26 | let jul:isize = mar(0,min(1,M - 7)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:26:24 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 26 | let jul:isize = max(0,main(1,M - 7)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:27:18 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ | help: a local variable with a similar name exists | 27 | let aug:isize = mar(0,min(1,M - 8)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:27:24 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 27 | let aug:isize = max(0,main(1,M - 8)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:28:18 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ | help: a local variable with a similar name exists | 28 | let sep:isize = mar(0,min(1,M - 9)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:28:24 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 28 | let sep:isize = max(0,main(1,M - 9)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:29:18 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ | help: a local variable with a similar name exists | 29 | let oct:isize = mar(0,min(1,M - 10)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:29:24 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 29 | let oct:isize = max(0,main(1,M - 10)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:30:18 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ | help: a local variable with a similar name exists | 30 | let nov:isize = mar(0,min(1,M - 11)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:30:24 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 30 | let nov:isize = max(0,main(1,M - 11)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:31:101 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ | help: a local variable with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * mar(0,min(1,M - 2)); | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:31:107 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,main(1,M - 2)); | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:41:5 | 41 | if args.len() == 4 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:42:11 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:42:33 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:43:9 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:43:31 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:44:10 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:44:32 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> OrdinalDate1.rs:47:3 | 47 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error: aborting due to 37 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc OrdinalDate1.rs error: unknown format trait `s` --> OrdinalDate1.rs:46:38 | 46 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!"))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:29 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:35 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:41 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:49 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:20:18 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:20:24 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 20 | let jan:isize = max(0,main(1,M - 1)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:21:18 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:21:24 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 21 | let feb:isize = max(0,main(1,M - 2)) * 28; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:22:18 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:22:24 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 22 | let mar:isize = max(0,main(1,M - 3)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:23:18 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ | help: a local variable with a similar name exists | 23 | let apr:isize = mar(0,min(1,M - 4)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:23:24 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 23 | let apr:isize = max(0,main(1,M - 4)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:24:18 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ | help: a local variable with a similar name exists | 24 | let may:isize = mar(0,min(1,M - 5)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:24:24 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 24 | let may:isize = max(0,main(1,M - 5)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:25:18 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ | help: a local variable with a similar name exists | 25 | let jun:isize = mar(0,min(1,M - 6)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:25:24 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 25 | let jun:isize = max(0,main(1,M - 6)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:26:18 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ | help: a local variable with a similar name exists | 26 | let jul:isize = mar(0,min(1,M - 7)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:26:24 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 26 | let jul:isize = max(0,main(1,M - 7)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:27:18 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ | help: a local variable with a similar name exists | 27 | let aug:isize = mar(0,min(1,M - 8)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:27:24 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 27 | let aug:isize = max(0,main(1,M - 8)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:28:18 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ | help: a local variable with a similar name exists | 28 | let sep:isize = mar(0,min(1,M - 9)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:28:24 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 28 | let sep:isize = max(0,main(1,M - 9)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:29:18 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ | help: a local variable with a similar name exists | 29 | let oct:isize = mar(0,min(1,M - 10)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:29:24 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 29 | let oct:isize = max(0,main(1,M - 10)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:30:18 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ | help: a local variable with a similar name exists | 30 | let nov:isize = mar(0,min(1,M - 11)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:30:24 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 30 | let nov:isize = max(0,main(1,M - 11)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:31:101 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ | help: a local variable with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * mar(0,min(1,M - 2)); | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:31:107 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,main(1,M - 2)); | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:41:5 | 41 | if args.len() == 4 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:42:11 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:42:33 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:43:9 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:43:31 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:44:10 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:44:32 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> OrdinalDate1.rs:47:3 | 47 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error: aborting due to 37 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc OrdinalDate1.rs error: unknown format trait `s` --> OrdinalDate1.rs:46:38 | 46 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!"))); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:29 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:35 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:41 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `d` --> OrdinalDate1.rs:51:49 | 51 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:20:18 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:20:24 | 20 | let jan:isize = max(0,min(1,M - 1)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 20 | let jan:isize = max(0,main(1,M - 1)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:21:18 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:21:24 | 21 | let feb:isize = max(0,min(1,M - 2)) * 28; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 21 | let feb:isize = max(0,main(1,M - 2)) * 28; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:22:18 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ not found in this scope | help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:22:24 | 22 | let mar:isize = max(0,min(1,M - 3)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 22 | let mar:isize = max(0,main(1,M - 3)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:23:18 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ | help: a local variable with a similar name exists | 23 | let apr:isize = mar(0,min(1,M - 4)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:23:24 | 23 | let apr:isize = max(0,min(1,M - 4)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 23 | let apr:isize = max(0,main(1,M - 4)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:24:18 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ | help: a local variable with a similar name exists | 24 | let may:isize = mar(0,min(1,M - 5)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:24:24 | 24 | let may:isize = max(0,min(1,M - 5)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 24 | let may:isize = max(0,main(1,M - 5)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:25:18 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ | help: a local variable with a similar name exists | 25 | let jun:isize = mar(0,min(1,M - 6)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:25:24 | 25 | let jun:isize = max(0,min(1,M - 6)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 25 | let jun:isize = max(0,main(1,M - 6)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:26:18 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ | help: a local variable with a similar name exists | 26 | let jul:isize = mar(0,min(1,M - 7)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:26:24 | 26 | let jul:isize = max(0,min(1,M - 7)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 26 | let jul:isize = max(0,main(1,M - 7)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:27:18 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ | help: a local variable with a similar name exists | 27 | let aug:isize = mar(0,min(1,M - 8)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:27:24 | 27 | let aug:isize = max(0,min(1,M - 8)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 27 | let aug:isize = max(0,main(1,M - 8)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:28:18 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ | help: a local variable with a similar name exists | 28 | let sep:isize = mar(0,min(1,M - 9)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:28:24 | 28 | let sep:isize = max(0,min(1,M - 9)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 28 | let sep:isize = max(0,main(1,M - 9)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:29:18 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ | help: a local variable with a similar name exists | 29 | let oct:isize = mar(0,min(1,M - 10)) * 31; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:29:24 | 29 | let oct:isize = max(0,min(1,M - 10)) * 31; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 29 | let oct:isize = max(0,main(1,M - 10)) * 31; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:30:18 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ | help: a local variable with a similar name exists | 30 | let nov:isize = mar(0,min(1,M - 11)) * 30; | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:30:24 | 30 | let nov:isize = max(0,min(1,M - 11)) * 30; | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 30 | let nov:isize = max(0,main(1,M - 11)) * 30; | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find function `max` in this scope --> OrdinalDate1.rs:31:101 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ | help: a local variable with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * mar(0,min(1,M - 2)); | ~~~ help: consider importing this function | 7 + use std::cmp::max; | error[E0425]: cannot find function `min` in this scope --> OrdinalDate1.rs:31:107 | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,min(1,M - 2)); | ^^^ ... 37 | fn main() { | --------- similarly named function `main` defined here | help: a function with a similar name exists | 31 | let leapYear:isize = (Y / 4 - Y / 100 + Y / 400 - ((Y - 1) / 4 - (Y - 1) / 100 + (Y - 1) / 400)) * max(0,main(1,M - 2)); | ~~~~ help: consider importing this function | 7 + use std::cmp::min; | error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:41:5 | 41 | if args.len() == 4 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:42:11 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:42:33 | 42 | month = Utils.stoiWithDefault(args[1], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:43:9 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:43:31 | 43 | day = Utils.stoiWithDefault(args[2], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> OrdinalDate1.rs:44:10 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> OrdinalDate1.rs:44:32 | 44 | year = Utils.stoiWithDefault(args[3], 0); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> OrdinalDate1.rs:47:3 | 47 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error: aborting due to 37 previous errors For more information about this error, try `rustc --explain E0425`.

Solution