История изменений
Исправление theNamelessOne, (текущая версия) :
// Collect command line arguments let args: Vec<String> = env::args().collect(); // Ensure we have exactly two arguments if args.len() != 3 { eprintln!("Usage: {} <set1> <set2>", args[0]); std::process::exit(1); } // ...snip... // Check that both character sets are of the same length if set1.chars().count() != set2.chars().count() { eprintln!("The sets must be of equal length."); std::process::exit(1); }
Я считаю, что не хватает ещё важных комментариев:
// Import module `std::env` as `env`
use std::env;
// Import module `std::io` as `io` and trait `std::io::BufRead` as `BufRead`
use std::io::{self, BufRead};
// Define the `main` function, which is the entry point of the application
fn main() {
Алсо, на расте tr
переписали уже как минимум один раз: https://github.com/uutils/coreutils/tree/main/src/uu/tr/src.
Исправление theNamelessOne, :
// Collect command line arguments let args: Vec<String> = env::args().collect(); // Ensure we have exactly two arguments if args.len() != 3 { eprintln!("Usage: {} <set1> <set2>", args[0]); std::process::exit(1); } // ...snip... // Check that both character sets are of the same length if set1.chars().count() != set2.chars().count() { eprintln!("The sets must be of equal length."); std::process::exit(1); }
Я считаю, что не хватает ещё важных комментариев:
// Import module `std::env` as `env`
use std::env;
// Import module `std::io` as `io` and trait `std::io::BufRead` as `BufRead`
use std::io::{self, BufRead};
// Declare the `main` function, which is the entry point of the application
fn main() {
Алсо, на расте tr
переписали уже как минимум один раз: https://github.com/uutils/coreutils/tree/main/src/uu/tr/src.
Исходная версия theNamelessOne, :
// Collect command line arguments let args: Vec<String> = env::args().collect(); // Ensure we have exactly two arguments if args.len() != 3 { eprintln!("Usage: {} <set1> <set2>", args[0]); std::process::exit(1); } // ...snip... // Check that both character sets are of the same length if set1.chars().count() != set2.chars().count() { eprintln!("The sets must be of equal length."); std::process::exit(1); }
Я считаю, что не хватает ещё важных комментариев:
// Import module `std::env` as `env`
use std::env;
// Import module `std::io` as `io` and trait `std::io::BufRead` as `BufRead`
use std::io::{self, BufRead};
// Declare the `main` functions, which is the entry point of the application
fn main() {
Алсо, на расте tr
переписали уже как минимум один раз: https://github.com/uutils/coreutils/tree/main/src/uu/tr/src.