Skip to content

Instantly share code, notes, and snippets.

@ostronom
Created March 30, 2015 16:34
Show Gist options
  • Save ostronom/6f886d739e7cd45fbb8d to your computer and use it in GitHub Desktop.
Save ostronom/6f886d739e7cd45fbb8d to your computer and use it in GitHub Desktop.
error: not all control paths return a value [E0269]. WTF?
use std::collections::HashMap;
use std::hash::Hash;
use std::cmp::Eq;
trait Transit {
fn tag(&self) -> &str;
fn rep(&self) -> String;
}
impl<K: Transit + Hash + Eq, V: Transit> Transit for HashMap<K, V> {
fn tag(&self) -> &str { "map" }
fn rep(&self) -> String {
String::from_str("LOLWUT?");
}
}
@michaelsproul
Copy link

If you haven't already sorted this out, it's the semicolon on line 15. A semicolon makes an expression into a statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment