Remove dead code

Nathan Sobo and Antonio Scandurra created

Co-Authored-By: Antonio Scandurra <me@as-cii.com>

Change summary

crates/language/src/proto.rs | 44 --------------------------------------
crates/text/src/locator.rs   |  5 ----
2 files changed, 49 deletions(-)

Detailed changes

crates/language/src/proto.rs 🔗

@@ -4,7 +4,6 @@ use crate::{
 };
 use anyhow::{anyhow, Result};
 use clock::ReplicaId;
-use collections::HashSet;
 use lsp::DiagnosticSeverity;
 use rpc::proto;
 use std::{ops::Range, sync::Arc};
@@ -100,26 +99,6 @@ pub fn serialize_undo_map_entry(
     }
 }
 
-pub fn serialize_buffer_fragment(fragment: &text::Fragment) -> proto::BufferFragment {
-    proto::BufferFragment {
-        replica_id: fragment.insertion_timestamp.replica_id as u32,
-        local_timestamp: fragment.insertion_timestamp.local,
-        lamport_timestamp: fragment.insertion_timestamp.lamport,
-        insertion_offset: fragment.insertion_offset as u32,
-        len: fragment.len as u32,
-        visible: fragment.visible,
-        deletions: fragment
-            .deletions
-            .iter()
-            .map(|clock| proto::VectorClockEntry {
-                replica_id: clock.replica_id as u32,
-                timestamp: clock.value,
-            })
-            .collect(),
-        max_undos: serialize_version(&fragment.max_undos),
-    }
-}
-
 pub fn serialize_selections(selections: &Arc<[Selection<Anchor>]>) -> Vec<proto::Selection> {
     selections
         .iter()
@@ -290,29 +269,6 @@ pub fn deserialize_undo_map_entry(
     )
 }
 
-pub fn deserialize_buffer_fragment(
-    message: proto::BufferFragment,
-    ix: usize,
-    count: usize,
-) -> Fragment {
-    Fragment {
-        id: locator::Locator::from_index(ix, count),
-        insertion_timestamp: InsertionTimestamp {
-            replica_id: message.replica_id as ReplicaId,
-            local: message.local_timestamp,
-            lamport: message.lamport_timestamp,
-        },
-        insertion_offset: message.insertion_offset as usize,
-        len: message.len as usize,
-        visible: message.visible,
-        deletions: HashSet::from_iter(message.deletions.into_iter().map(|entry| clock::Local {
-            replica_id: entry.replica_id as ReplicaId,
-            value: entry.timestamp,
-        })),
-        max_undos: deserialize_version(message.max_undos),
-    }
-}
-
 pub fn deserialize_selections(selections: Vec<proto::Selection>) -> Arc<[Selection<Anchor>]> {
     Arc::from(
         selections

crates/text/src/locator.rs 🔗

@@ -19,11 +19,6 @@ impl Locator {
         Self(smallvec![u64::MAX])
     }
 
-    pub fn from_index(ix: usize, count: usize) -> Self {
-        let id = (1 + ix as u64) * (u64::MAX / (count as u64 + 2));
-        Self(smallvec![id])
-    }
-
     pub fn assign(&mut self, other: &Self) {
         self.0.resize(other.0.len(), 0);
         self.0.copy_from_slice(&other.0);