Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions bin/oli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Config {
let profiles = Config::load_from_env().profiles.into_iter().fold(
cfg.profiles,
|mut acc, (name, opts)| {
acc.entry(name).or_insert_with(HashMap::new).extend(opts);
acc.entry(name).or_default().extend(opts);
acc
},
);
Expand Down Expand Up @@ -115,12 +115,13 @@ impl Config {
},
)
})
.fold(HashMap::new(), |mut acc, (profile_name, key, val)| {
acc.entry(profile_name)
.or_insert_with(HashMap::new)
.insert(key, val);
acc
});
.fold(
HashMap::new(),
|mut acc: HashMap<String, HashMap<_, _>>, (profile_name, key, val)| {
acc.entry(profile_name).or_default().insert(key, val);
acc
},
);
Config { profiles }
}

Expand Down
4 changes: 1 addition & 3 deletions bin/oli/tests/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ async fn test_cat_for_path_in_current_dir() -> Result<()> {

let mut cmd = Command::cargo_bin("oli")?;

cmd.arg("cat")
.arg("dst.txt")
.current_dir(dir.path().clone());
cmd.arg("cat").arg("dst.txt").current_dir(dir.path());
let actual = fs::read_to_string(&dst_path)?;
let res = cmd.assert().success();
let output = res.get_output().stdout.clone();
Expand Down
2 changes: 1 addition & 1 deletion bin/oli/tests/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async fn test_cp_for_path_in_current_dir() -> Result<()> {
cmd.arg("cp")
.arg("src.txt")
.arg("dst.txt")
.current_dir(dir.path().clone());
.current_dir(dir.path());
cmd.assert().success();

let actual = fs::read_to_string(dst_path)?;
Expand Down
2 changes: 1 addition & 1 deletion bin/oli/tests/rm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn test_rm_for_path_in_current_dir() -> Result<()> {

let mut cmd = Command::cargo_bin("oli")?;

cmd.arg("rm").arg("dst.txt").current_dir(dir.path().clone());
cmd.arg("rm").arg("dst.txt").current_dir(dir.path());
cmd.assert().success();

assert!(fs::read_to_string(&dst_path).is_err());
Expand Down
4 changes: 1 addition & 3 deletions bin/oli/tests/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ async fn test_stat_for_path_in_current_dir() -> Result<()> {

let mut cmd = Command::cargo_bin("oli")?;

cmd.arg("stat")
.arg("dst.txt")
.current_dir(dir.path().clone());
cmd.arg("stat").arg("dst.txt").current_dir(dir.path());
let res = cmd.assert().success();
let output = res.get_output().stdout.clone();

Expand Down
2 changes: 1 addition & 1 deletion core/src/layers/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ mod tests {
fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<Bytes>>> {
let mut bs = vec![0; 1];
match ready!(self.poll_read(cx, &mut bs)) {
Ok(v) if v == 0 => Poll::Ready(None),
Ok(0) => Poll::Ready(None),
Ok(v) => Poll::Ready(Some(Ok(Bytes::from(bs[..v].to_vec())))),
Err(err) => Poll::Ready(Some(Err(err))),
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/raw/oio/read/into_seekable_read_by_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ where
self.poll_read(cx, buf)
}
State::Reading(r) => match ready!(Pin::new(r).poll_read(cx, buf)) {
Ok(n) if n == 0 => {
Ok(0) => {
// Reset state to Idle after all data has been consumed.
self.state = State::Idle;
Poll::Ready(Ok(0))
Expand Down Expand Up @@ -293,7 +293,7 @@ where
}
State::Reading(r) => {
match r.read(buf) {
Ok(n) if n == 0 => {
Ok(0) => {
// Reset state to Idle after all data has been consumed.
self.state = State::Idle;
Ok(0)
Expand Down
1 change: 0 additions & 1 deletion core/src/types/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ impl Stream for Lister {

let acc = self.acc.clone();
let fut = async move {
let path = path;
let res = acc.stat(&path, OpStat::default()).await;

(path, res)
Expand Down