mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 14:00:51 -05:00
Include version in cache key
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use std::borrow::Cow;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -8,6 +7,8 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::message::Message;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct CacheMetadata {
|
||||
size: u64,
|
||||
@@ -66,8 +67,8 @@ fn cache_dir() -> &'static str {
|
||||
"./.cache"
|
||||
}
|
||||
|
||||
fn cache_key(path: &Path) -> Cow<str> {
|
||||
path.to_string_lossy()
|
||||
fn cache_key(path: &Path) -> String {
|
||||
format!("{}@{}", path.to_string_lossy(), VERSION)
|
||||
}
|
||||
|
||||
pub fn get(path: &Path, mode: &Mode) -> Option<Vec<Message>> {
|
||||
|
||||
Reference in New Issue
Block a user