From 4cb3664c9d516885192951fd0a54c9ed360f6f6a Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Wed, 18 Nov 2020 11:22:45 +0100 Subject: [PATCH] remove unnecessary static lifetimes from exercises --- exercises/diamond/example.rs | 2 +- exercises/nucleotide-count/example.rs | 2 +- exercises/pangram/example.rs | 2 +- exercises/robot-name/example.rs | 4 ++-- exercises/roman-numerals/example.rs | 2 +- exercises/say/example.rs | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/exercises/diamond/example.rs b/exercises/diamond/example.rs index 8f73aff55..00783cdfc 100644 --- a/exercises/diamond/example.rs +++ b/exercises/diamond/example.rs @@ -1,4 +1,4 @@ -static ABC: &'static str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +static ABC: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; pub fn get_diamond(diamond_char: char) -> Vec { let mut result: Vec = Vec::new(); diff --git a/exercises/nucleotide-count/example.rs b/exercises/nucleotide-count/example.rs index 096f63763..661196e53 100644 --- a/exercises/nucleotide-count/example.rs +++ b/exercises/nucleotide-count/example.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -static VALID_NUCLEOTIDES: &'static str = "ACGT"; +static VALID_NUCLEOTIDES: &str = "ACGT"; fn valid(c: char) -> Result { if VALID_NUCLEOTIDES.contains(c) { diff --git a/exercises/pangram/example.rs b/exercises/pangram/example.rs index f2870ea27..0695fb468 100644 --- a/exercises/pangram/example.rs +++ b/exercises/pangram/example.rs @@ -15,4 +15,4 @@ fn english_letter_set() -> BTreeSet { BTreeSet::from_iter(ENGLISH_ALPHABET.chars()) } -const ENGLISH_ALPHABET: &'static str = "abcdefghijklmnopqrstuvwxyz"; +const ENGLISH_ALPHABET: &str = "abcdefghijklmnopqrstuvwxyz"; diff --git a/exercises/robot-name/example.rs b/exercises/robot-name/example.rs index 77b00eda8..9d1c46086 100644 --- a/exercises/robot-name/example.rs +++ b/exercises/robot-name/example.rs @@ -7,8 +7,8 @@ pub struct Robot { fn generate_name() -> String { let mut s = String::with_capacity(5); - static LETTERS: &'static [u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - static NUMBERS: &'static [u8] = b"0123456789"; + static LETTERS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + static NUMBERS: &[u8] = b"0123456789"; for _ in 0..2 { s.push(*thread_rng().choose(LETTERS).unwrap() as char); } diff --git a/exercises/roman-numerals/example.rs b/exercises/roman-numerals/example.rs index ad7bacbdd..371974a4b 100644 --- a/exercises/roman-numerals/example.rs +++ b/exercises/roman-numerals/example.rs @@ -1,6 +1,6 @@ use std::fmt; -static ROMAN_MAP: [(usize, &'static str); 13] = [ +static ROMAN_MAP: [(usize, &str); 13] = [ (1, "I"), (4, "IV"), (5, "V"), diff --git a/exercises/say/example.rs b/exercises/say/example.rs index 2703eb038..003e22630 100644 --- a/exercises/say/example.rs +++ b/exercises/say/example.rs @@ -1,4 +1,4 @@ -const SMALL: &'static [&'static str] = &[ +const SMALL: &[&str] = &[ "zero", "one", "two", @@ -21,11 +21,11 @@ const SMALL: &'static [&'static str] = &[ "nineteen", ]; -const TENS: &'static [&'static str] = &[ +const TENS: &[&str] = &[ "ones", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", ]; -const SCALE: &'static [&'static str] = &[ +const SCALE: &[&str] = &[ "", "thousand", "million",