Add fs::MTime
newtype to encourage !=
instead of >
(#20830)
See ["mtime comparison considered harmful"](https://apenwarr.ca/log/20181113) for details of why comparators other than equality/inequality should not be used with mtime. Release Notes: - N/A
This commit is contained in:
parent
477c6e6833
commit
14ea4621ab
15 changed files with 155 additions and 112 deletions
|
@ -7,6 +7,7 @@ use anyhow::{anyhow, Context as _, Result};
|
|||
use collections::Bound;
|
||||
use feature_flags::FeatureFlagAppExt;
|
||||
use fs::Fs;
|
||||
use fs::MTime;
|
||||
use futures::stream::StreamExt;
|
||||
use futures_batch::ChunksTimeoutStreamExt;
|
||||
use gpui::{AppContext, Model, Task};
|
||||
|
@ -17,14 +18,7 @@ use project::{Entry, UpdatedEntriesSet, Worktree};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use smol::channel;
|
||||
use smol::future::FutureExt;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
future::Future,
|
||||
iter,
|
||||
path::Path,
|
||||
sync::Arc,
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
use std::{cmp::Ordering, future::Future, iter, path::Path, sync::Arc, time::Duration};
|
||||
use util::ResultExt;
|
||||
use worktree::Snapshot;
|
||||
|
||||
|
@ -451,7 +445,7 @@ struct ChunkFiles {
|
|||
|
||||
pub struct ChunkedFile {
|
||||
pub path: Arc<Path>,
|
||||
pub mtime: Option<SystemTime>,
|
||||
pub mtime: Option<MTime>,
|
||||
pub handle: IndexingEntryHandle,
|
||||
pub text: String,
|
||||
pub chunks: Vec<Chunk>,
|
||||
|
@ -465,7 +459,7 @@ pub struct EmbedFiles {
|
|||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct EmbeddedFile {
|
||||
pub path: Arc<Path>,
|
||||
pub mtime: Option<SystemTime>,
|
||||
pub mtime: Option<MTime>,
|
||||
pub chunks: Vec<EmbeddedChunk>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue