Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. let mut profile:&str = {
  2. let array = cmdline.arc();
  3. {
  4. let read = array.read().unwrap();
  5. if read.contains_key("profile"){
  6. if let Some(prof) = read.get("profile"){
  7. if prof.len() > 0 {
  8. prof.as_str()
  9. }
  10. }
  11. }
  12. }
  13.  
  14. {
  15. let mut write = array.write().unwrap();
  16. write.insert("profile".to_string(), "default".to_string());
  17. }
  18. "default"
  19. };
  20.  
  21.  
  22. error[E0308]: mismatched types
  23. --> src/main.rs:177:8
  24. |
  25. 67 | fn main() {
  26. | - expected `()` because of default return type
  27. ...
  28. 177 | prof.as_str()
  29. | ^^^^^^^^^^^^^- help: try adding a semicolon: `;`
  30. | |
  31. | expected (), found &str
  32. |
  33. = note: expected type `()`
  34. found type `&str`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement