Correct formatting.

This commit is contained in:
2019-02-18 15:13:48 +01:00
parent 171d9fa2e9
commit c16ef40d73
28 changed files with 316 additions and 195 deletions

View File

@@ -20,7 +20,8 @@ pub trait Point {
}
impl<T> Point for (T, T)
where T: Add<Output=T> + Sub<Output=T> + Copy + Ord
where
T: Add<Output = T> + Sub<Output = T> + Copy + Ord,
{
type CoordType = T;
@@ -32,7 +33,8 @@ impl<T> Point for (T, T)
}
impl<T> Point for (T, T, T)
where T: Add<Output=T> + Sub<Output=T> + Copy + Ord
where
T: Add<Output = T> + Sub<Output = T> + Copy + Ord,
{
type CoordType = T;
@@ -44,7 +46,8 @@ impl<T> Point for (T, T, T)
}
impl<T> Point for [T; 4]
where T: Default + Add<Output=T> + Sub<Output=T> + Copy + Ord
where
T: Default + Add<Output = T> + Sub<Output = T> + Copy + Ord,
{
type CoordType = T;
@@ -58,7 +61,6 @@ where T: Default + Add<Output=T> + Sub<Output=T> + Copy + Ord
}
}
/// Apply Erathostenes's sieve to the supplied array
///
/// # Arguments
@@ -111,8 +113,9 @@ pub fn trim_back(input: &mut Vec<u8>) {
///
/// This function loads the input into a string and then attempts to parse it.
pub fn read_single_input<T>(input: &mut Read) -> T
where T: FromStr,
<T as FromStr>::Err: Debug
where
T: FromStr,
<T as FromStr>::Err: Debug,
{
let mut buf = String::new();
input.read_to_string(&mut buf).unwrap();
@@ -132,12 +135,13 @@ pub trait GroupingCount {
}
impl<T> GroupingCount for T
where T: Iterator,
T::Item: Eq + Hash {
where
T: Iterator,
T::Item: Eq + Hash,
{
type Type = T::Item;
fn grouping_count(&mut self) -> HashMap<Self::Type, usize>
{
fn grouping_count(&mut self) -> HashMap<Self::Type, usize> {
let mut counts = HashMap::new();
for element in self {
@@ -170,11 +174,7 @@ mod tests {
prime_sieve(&mut input);
let output = [
false, false,
true, true,
false, true,
false, true,
false, false
false, false, true, true, false, true, false, true, false, false,
];
assert_eq!(output, input);