-
Notifications
You must be signed in to change notification settings - Fork 1
List of Rust Kata to Update
From Rust 1.50, we stopped concatenating preloaded code and started to use preloaded.rs. This fixes the line number mismatch, minimizes the awkwardness, and makes it easier for users to solve locally.
This breaks existing solutions for kata using preloaded because the solution must include mod preloaded; now. But it's better to do this now considering how Rust is getting more and more popular on Codewars.
This section lists affected kata and what we can do about them. Fortunately, it looks like many of them can avoid breaking existing solutions.
For affected kata, also consider fixing any unidiomatic Rust because it's a breaking change anyway.
This one is awkward. Capital struct should have either country or state set. There's nothing preventing them to be unset or both set.
Current preloaded
struct Capital<'a> {
capital: &'a str,
country: Option<&'a str>,
state: Option<&'a str>,
}
impl<'a> Capital<'a> {
fn new_country(capital: &'a str, country: &'a str) -> Capital<'a> {
Capital {
capital: capital,
country: Some(country),
state: None,
}
}
fn new_state(capital: &'a str, state: &'a str) -> Capital<'a> {
Capital {
capital: capital,
country: None,
state: Some(state),
}
}
}Constructors are only used in tests, and using Into<String> is less awkward.
Preloaded for 1.50
pub struct Capital {
pub capital: String,
pub country: Option<String>,
pub state: Option<String>,
}
impl Capital {
fn new_country<S: Into<String>>(capital: S, country: S) -> Capital {
Capital {
capital: capital.into(),
country: Some(country.into()),
state: None,
}
}
fn new_state<S: Into<String>>(capital: S, state: S) -> Capital {
Capital {
capital: capital.into(),
country: None,
state: Some(state.into()),
}
}
}enum is more Rusty:
pub enum Capital {
State { state: String, capital: String },
Country { country: String, capital: String },
}-
Transforming Maze Solver Return empty
Vecwhen no solution.
The reference solution sometimes fails random tests.
float_eq was added to Rust 1.50. The following kata have tests matching /assert_fuzzy/, so it should probably be replaced.
- Braking well
- Euler's method for a first-order ODE
- Floating-point Approximation (I)
- Floating-point Approximation (III)
- Going to zero or to infinity?
- Magnet particules in boxes
- Parabolic Arc Length
- Positions Average
- Probabilities for Sums in Rolling Cubic Dice
- Rainfall
- Robinson Crusoe
- Simpson's Rule - Approximate Integration
- Which x for that sum?
- Agda Kata that require rank adjustment
- List of Possible Duplicate Kata
- List of kata that are candidates to retirement
- List of Kata with font Tag in Description (possibly broken)
- Potentially Plagiarized Kata
- Tags and topics to assign to kata
- List of Agda Kata to Update
- List of C Kata to Update
- List of C++ Kata to Update
- List of COBOL Kata to Update
- List of Coq Kata to Update
- List of Crystal Kata to Update
- List of C# Kata to Update
- List of Dart Kata to Update
- List of Elixir Kata to Update
- List of Go Kata to Update
- List of Haskell Kata to Update
- List of Java Kata to Update
- List of JavaScript Kata to Update
- List of Kotlin Kata to Update
- List of Lean Kata to Update
- List of Nim Kata to Update
- List of PHP Kata to Update
- List of Python Kata to Update
- List of Racket Kata to Update
- List of Ruby Kata to Update
- List of Rust Kata to Update
- List of Scala Kata to Update
- List of Solidity Kata to Update
- List of Swift Kata to Update
- List of TypeScript Kata to Update