Skip to content

Commit

Permalink
Stop reading deserialize_fingerprint (zed-industries#9668)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
  • Loading branch information
ConradIrwin and osiewicz authored Mar 27, 2024
1 parent 8583c3b commit 140b841
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion crates/language/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ impl Buffer {
.ok_or_else(|| anyhow!("missing line_ending"))?,
));
this.saved_version = proto::deserialize_version(&message.saved_version);
this.file_fingerprint = proto::deserialize_fingerprint(&message.saved_version_fingerprint)?;
this.saved_mtime = message.saved_mtime.map(|time| time.into());
Ok(this)
}
Expand Down
6 changes: 0 additions & 6 deletions crates/language/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ pub fn serialize_fingerprint(fingerprint: RopeFingerprint) -> String {
fingerprint.to_hex()
}

/// Deserializes a [`RopeFingerprint`] from the RPC representation.
pub fn deserialize_fingerprint(fingerprint: &str) -> Result<RopeFingerprint> {
RopeFingerprint::from_hex(fingerprint)
.map_err(|error| anyhow!("invalid fingerprint: {}", error))
}

/// Deserializes a `[text::LineEnding]` from the RPC representation.
pub fn deserialize_line_ending(message: proto::LineEnding) -> text::LineEnding {
match message {
Expand Down
10 changes: 5 additions & 5 deletions crates/project/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ use language::{
language_settings::{language_settings, FormatOnSave, Formatter, InlayHintKind},
markdown, point_to_lsp,
proto::{
deserialize_anchor, deserialize_fingerprint, deserialize_line_ending, deserialize_version,
serialize_anchor, serialize_version, split_operations,
deserialize_anchor, deserialize_line_ending, deserialize_version, serialize_anchor,
serialize_version, split_operations,
},
range_from_lsp, Bias, Buffer, BufferSnapshot, CachedLspAdapter, Capability, CodeAction,
CodeLabel, Completion, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, Documentation,
Expand Down Expand Up @@ -92,7 +92,7 @@ use std::{
};
use task::static_source::{StaticSource, TrackedFile};
use terminals::Terminals;
use text::{Anchor, BufferId};
use text::{Anchor, BufferId, RopeFingerprint};
use util::{
debug_panic, defer,
http::HttpClient,
Expand Down Expand Up @@ -8903,7 +8903,7 @@ impl Project {
_: Arc<Client>,
mut cx: AsyncAppContext,
) -> Result<()> {
let fingerprint = deserialize_fingerprint(&envelope.payload.fingerprint)?;
let fingerprint = Default::default();
let version = deserialize_version(&envelope.payload.version);
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
let mtime = envelope.payload.mtime.map(|time| time.into());
Expand Down Expand Up @@ -8931,7 +8931,7 @@ impl Project {
) -> Result<()> {
let payload = envelope.payload;
let version = deserialize_version(&payload.version);
let fingerprint = deserialize_fingerprint(&payload.fingerprint)?;
let fingerprint = RopeFingerprint::default();
let line_ending = deserialize_line_ending(
proto::LineEnding::from_i32(payload.line_ending)
.ok_or_else(|| anyhow!("missing line ending"))?,
Expand Down
7 changes: 2 additions & 5 deletions crates/worktree/src/worktree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ use gpui::{
use ignore::IgnoreStack;
use itertools::Itertools;
use language::{
proto::{
deserialize_fingerprint, deserialize_version, serialize_fingerprint, serialize_line_ending,
serialize_version,
},
proto::{deserialize_version, serialize_fingerprint, serialize_line_ending, serialize_version},
Buffer, Capability, DiagnosticEntry, File as _, LineEnding, PointUtf16, Rope, RopeFingerprint,
Unclipped,
};
Expand Down Expand Up @@ -1631,7 +1628,7 @@ impl RemoteWorktree {
})
.await?;
let version = deserialize_version(&response.version);
let fingerprint = deserialize_fingerprint(&response.fingerprint)?;
let fingerprint = RopeFingerprint::default();
let mtime = response.mtime.map(|mtime| mtime.into());

buffer_handle.update(&mut cx, |buffer, cx| {
Expand Down

0 comments on commit 140b841

Please sign in to comment.