Skip to content

Commit

Permalink
fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
qingwen220 committed Nov 15, 2023
1 parent 08c2f52 commit 3ce8838
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/src/services/hdfs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ unsafe impl Send for HdfsBackend {}
unsafe impl Sync for HdfsBackend {}

impl HdfsBackend {
fn create_parent_if_need(&self, path: &str) -> Result<()>{
fn create_parent_if_need(&self, path: &str) -> Result<()> {
if let Err(err) = self.client.metadata(path) {
// Early return if other error happened.
if err.kind() != io::ErrorKind::NotFound {
Expand All @@ -169,7 +169,8 @@ impl HdfsBackend {
Error::new(
ErrorKind::Unexpected,
"path should have parent but not, it must be malformed",
).with_context("input", path)
)
.with_context("input", path)
})?
.to_path_buf();

Expand Down Expand Up @@ -280,10 +281,12 @@ impl Accessor for HdfsBackend {

async fn rename(&self, from: &str, to: &str, args: OpRename) -> Result<RpRename> {
let from_path = build_rooted_abs_path(&self.root, from);
let to_path = build_rooted_abs_path(&self.root, to);
let to_path = build_rooted_abs_path(&self.root, to);
self.create_parent_if_need(&to_path)?;

self.client.rename_file( &from_path, &to_path).map_err(new_std_io_error)?;
self.client
.rename_file(&from_path, &to_path)
.map_err(new_std_io_error)?;

Ok(RpRename::new())
}
Expand Down Expand Up @@ -407,10 +410,12 @@ impl Accessor for HdfsBackend {

fn blocking_rename(&self, from: &str, to: &str, args: OpRename) -> Result<RpRename> {
let from_path = build_rooted_abs_path(&self.root, from);
let to_path = build_rooted_abs_path(&self.root, to);
let to_path = build_rooted_abs_path(&self.root, to);
self.create_parent_if_need(&to_path)?;

self.client.rename_file( &from_path, &to_path).map_err(new_std_io_error)?;
self.client
.rename_file(&from_path, &to_path)
.map_err(new_std_io_error)?;

Ok(RpRename::new())
}
Expand Down

0 comments on commit 3ce8838

Please sign in to comment.