Skip to content

Commit 29193ac

Browse files
Improve error message for cache info serialization (#8500)
## Summary We no longer need this struct; we bumped the cache bucket version anyway, so the `Timestamp` variant is never encountered. This means we get real Serde error messages. Closes #8488.
1 parent fa14ea4 commit 29193ac

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

crates/uv-cache-info/src/cache_info.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub enum CacheInfoError {
1818
/// timestamps of relevant files, the current commit of a repository, etc.
1919
#[derive(Default, Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
2020
#[serde(rename_all = "kebab-case")]
21-
#[serde(try_from = "CacheInfoWire")]
2221
pub struct CacheInfo {
2322
/// The timestamp of the most recent `ctime` of any relevant files, at the time of the build.
2423
/// The timestamp will typically be the maximum of the `ctime` values of the `pyproject.toml`,
@@ -200,46 +199,6 @@ impl CacheInfo {
200199
}
201200
}
202201

203-
#[derive(Debug, serde::Deserialize)]
204-
struct TimestampCommit {
205-
#[serde(default)]
206-
timestamp: Option<Timestamp>,
207-
#[serde(default)]
208-
commit: Option<Commit>,
209-
#[serde(default)]
210-
tags: Option<Tags>,
211-
}
212-
213-
#[derive(Debug, serde::Deserialize)]
214-
#[serde(untagged)]
215-
enum CacheInfoWire {
216-
/// For backwards-compatibility, enable deserializing [`CacheInfo`] structs that are solely
217-
/// represented by a timestamp.
218-
Timestamp(Timestamp),
219-
/// A [`CacheInfo`] struct that includes both a timestamp and a commit.
220-
TimestampCommit(TimestampCommit),
221-
}
222-
223-
impl From<CacheInfoWire> for CacheInfo {
224-
fn from(wire: CacheInfoWire) -> Self {
225-
match wire {
226-
CacheInfoWire::Timestamp(timestamp) => Self {
227-
timestamp: Some(timestamp),
228-
..Self::default()
229-
},
230-
CacheInfoWire::TimestampCommit(TimestampCommit {
231-
timestamp,
232-
commit,
233-
tags,
234-
}) => Self {
235-
timestamp,
236-
commit,
237-
tags,
238-
},
239-
}
240-
}
241-
}
242-
243202
/// A `pyproject.toml` with an (optional) `[tool.uv]` section.
244203
#[derive(Debug, Deserialize)]
245204
#[serde(rename_all = "kebab-case")]

0 commit comments

Comments
 (0)