diff --git a/lib/src/conflicts.rs b/lib/src/conflicts.rs index 1cf18c6c6..c97c30303 100644 --- a/lib/src/conflicts.rs +++ b/lib/src/conflicts.rs @@ -164,9 +164,9 @@ pub fn materialize_conflict( .collect_vec(); let removed_slices = removed_content .iter() - .map(|vec| vec.as_slice()) + .map(Vec::as_slice) .collect_vec(); - let added_slices = added_content.iter().map(|vec| vec.as_slice()).collect_vec(); + let added_slices = added_content.iter().map(Vec::as_slice).collect_vec(); let merge_result = files::merge(&removed_slices, &added_slices); match merge_result { diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index 7ee12c408..78004be36 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -222,7 +222,7 @@ impl Backend for GitBackend { let mut bytes = Vec::new(); contents.read_to_end(&mut bytes).unwrap(); let locked_repo = self.repo.lock().unwrap(); - let oid = locked_repo.blob(bytes.as_slice()).unwrap(); + let oid = locked_repo.blob(&bytes).unwrap(); Ok(FileId::new(oid.as_bytes().to_vec())) } @@ -428,7 +428,7 @@ impl Backend for GitBackend { .unwrap() .start_modification(); if let Some(existing_extras) = mut_table.get_value(git_id.as_bytes()) { - if existing_extras != extras.as_slice() { + if existing_extras != &extras { return Err(BackendError::Other(format!( "Git commit '{}' already exists with different associated non-Git meta-data", id.hex() diff --git a/lib/src/stacked_table.rs b/lib/src/stacked_table.rs index 7fe571051..b6f226c30 100644 --- a/lib/src/stacked_table.rs +++ b/lib/src/stacked_table.rs @@ -177,7 +177,7 @@ impl<'table> ReadonlyTableIndexEntry<'table> { fn new(table: &'table ReadonlyTable, pos: usize) -> Self { let entry_size = ReadonlyTableIndexEntry::size(table.key_size); let offset = entry_size * pos; - let data = &table.index.as_slice()[offset..offset + entry_size]; + let data = &table.index[offset..offset + entry_size]; ReadonlyTableIndexEntry { data } } diff --git a/lib/tests/test_merge_trees.rs b/lib/tests/test_merge_trees.rs index 393c0773e..05076afc8 100644 --- a/lib/tests/test_merge_trees.rs +++ b/lib/tests/test_merge_trees.rs @@ -630,7 +630,7 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) { executable: false, }) => { assert_eq!( - testutils::read_file(repo.store(), &path, &id).as_slice(), + testutils::read_file(repo.store(), &path, &id), b"AbC\ndef\nGhi\n" ); } diff --git a/src/formatter.rs b/src/formatter.rs index 9a8f9ae76..31a2f0047 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -31,7 +31,7 @@ pub trait Formatter: Write { fn write_from_reader(&mut self, reader: &mut dyn Read) -> io::Result<()> { let mut buffer = vec![]; reader.read_to_end(&mut buffer).unwrap(); - self.write_all(buffer.as_slice()) + self.write_all(&buffer) } fn add_label(&mut self, label: String) -> io::Result<()>;