Convert scm/hg/lib/bookmarkstore to Rust 2018

Summary:
Rust 2018 updates to:
  //scm/hg/lib/bookmarkstore:bookmarkstore
  //scm/hg/lib/bookmarkstore:bookmarkstore-unittest

Reviewed By: xavierd

Differential Revision: D15465461

fbshipit-source-id: 01d1b68c82e7d185a8235c94321f86a7937738a5
This commit is contained in:
Jeremy Fitzhardinge 2019-05-23 16:29:19 -07:00 committed by Facebook Github Bot
parent 272b20b443
commit 70a5636b92

View File

@ -6,7 +6,6 @@
//! //!
//! Bookmarks can be loaded from an existing hg bookmarks file. //! Bookmarks can be loaded from an existing hg bookmarks file.
extern crate atomicwrites;
#[macro_use] #[macro_use]
extern crate failure; extern crate failure;
extern crate indexedlog; extern crate indexedlog;
@ -154,7 +153,7 @@ enum BookmarkEntry<'a> {
} }
impl<'a> BookmarkEntry<'a> { impl<'a> BookmarkEntry<'a> {
fn pack(bookmark_entry: &BookmarkEntry) -> Vec<u8> { fn pack(bookmark_entry: &BookmarkEntry<'_>) -> Vec<u8> {
let mut result = Vec::new(); let mut result = Vec::new();
match bookmark_entry { match bookmark_entry {
BookmarkEntry::Remove { bookmark } => { BookmarkEntry::Remove { bookmark } => {
@ -170,7 +169,7 @@ impl<'a> BookmarkEntry<'a> {
result result
} }
fn unpack(data: &[u8]) -> BookmarkEntry { fn unpack(data: &[u8]) -> BookmarkEntry<'_> {
match data[0] { match data[0] {
b'R' => { b'R' => {
let bookmark = str::from_utf8(&data[1..]).unwrap(); let bookmark = str::from_utf8(&data[1..]).unwrap();