chore: improve code comments clarity
Signed-off-by: stringscut <stringscut@outlook.jp>
This commit is contained in:
parent
f00fe0f0ae
commit
2185d79a11
|
|
@ -37,7 +37,7 @@ fn import_autojump(db: &mut Database, buffer: &str) -> Result<()> {
|
|||
let mut rank = rank.parse::<f64>().with_context(|| format!("invalid rank: {rank}"))?;
|
||||
// Normalize the rank using a sigmoid function. Don't import actual ranks from
|
||||
// autojump, since its scoring algorithm is very different and might
|
||||
// take a while to get normalized.
|
||||
// take a while to normalize.
|
||||
rank = sigmoid(rank);
|
||||
|
||||
db.add_unchecked(path, rank, 0);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ impl Database {
|
|||
}
|
||||
|
||||
/// Creates a new directory. This will create a duplicate entry if this
|
||||
/// directory is always in the database, it is expected that the user either
|
||||
/// directory is already in the database, it is expected that the user either
|
||||
/// does a check before calling this, or calls `dedup()` afterward.
|
||||
pub fn add_unchecked(&mut self, path: impl AsRef<str> + Into<String>, rank: Rank, now: Epoch) {
|
||||
self.with_dirs_mut(|dirs| {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ impl<'a> Stream<'a> {
|
|||
}
|
||||
|
||||
// The logic here is reversed - if we resolve symlinks when adding entries to
|
||||
// the database, we should not return symlinks when querying back from
|
||||
// the database, we should not return symlinks when querying from
|
||||
// the database.
|
||||
let resolver =
|
||||
if self.options.resolve_symlinks { fs::symlink_metadata } else { fs::metadata };
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ mod tests {
|
|||
let mut source = String::new();
|
||||
|
||||
// Filter out lines using edit:*, since those functions are only available in
|
||||
// the interactive editor.
|
||||
// interactive editor mode.
|
||||
for line in Elvish(&opts).render().unwrap().lines().filter(|line| !line.contains("edit:")) {
|
||||
source.push_str(line);
|
||||
source.push('\n');
|
||||
|
|
|
|||
Loading…
Reference in New Issue