Skip to content

Commit 21211e4

Browse files
committed
Add DeepSource
1 parent 3483ab0 commit 21211e4

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/cmd/import.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ fn import_autojump(db: &mut Database, buffer: &str) -> Result<()> {
3131
if line.is_empty() {
3232
continue;
3333
}
34-
let mut split = line.splitn(2, '\t');
34+
let (rank, path) =
35+
line.split_once('\t').with_context(|| format!("invalid entry: {line}"))?;
3536

36-
let rank = split.next().with_context(|| format!("invalid entry: {line}"))?;
3737
let mut rank = rank.parse::<f64>().with_context(|| format!("invalid rank: {rank}"))?;
3838
// Normalize the rank using a sigmoid function. Don't import actual ranks from
3939
// autojump, since its scoring algorithm is very different and might
4040
// take a while to get normalized.
4141
rank = sigmoid(rank);
4242

43-
let path = split.next().with_context(|| format!("invalid entry: {line}"))?;
44-
4543
db.add_unchecked(path, rank, 0);
4644
}
4745

src/shell.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,11 @@ mod tests {
9696
#[apply(opts)]
9797
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
9898
let opts = Opts { cmd, hook, echo, resolve_symlinks };
99-
let mut source = String::new();
99+
let mut source = String::default();
100100

101101
// Filter out lines using edit:*, since those functions are only available in
102102
// the interactive editor.
103-
for line in
104-
Elvish(&opts).render().unwrap().split('\n').filter(|line| !line.contains("edit:"))
105-
{
103+
for line in Elvish(&opts).render().unwrap().lines().filter(|line| !line.contains("edit:")) {
106104
source.push_str(line);
107105
source.push('\n');
108106
}

src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl FzfChild {
135135
mem::drop(self.0.stdin.take());
136136

137137
let mut stdout = self.0.stdout.take().unwrap();
138-
let mut output = String::new();
138+
let mut output = String::default();
139139
stdout.read_to_string(&mut output).context("failed to read from fzf")?;
140140

141141
let status = self.0.wait().context("wait failed on fzf")?;

0 commit comments

Comments
 (0)