Skip to content

Commit

Permalink
fix: poorly formatted rust code (holochain#288)
Browse files Browse the repository at this point in the history
* fix: poorly formatted code in coordinator zome

* document add_newlines

* clearn up coordinators module

* clean up integrity module

* refactor utils

* fix add_newlines

* update integrity comments

* fix map file calls

* fix add_newlines

* make add_newlines public/private function agnostic

* refactor link-type coordinator

* fix  remove link handler

* fix collection coordinator

* clean up entry-type coordinator

* fix clippy warnings

* refactor link-type coordinator

* fix bug scaffolding entry-type with linked_from

* fix target_hash_variable

* remove unnecessary format usage

* remove unnecessary clone

* fix validate_delete_result

* move comment

* fix entry from rcord error message

* rename unparse function to unparse_pretty;
  • Loading branch information
c12i committed Jun 5, 2024
1 parent 341d6a4 commit 75dfad2
Show file tree
Hide file tree
Showing 6 changed files with 999 additions and 791 deletions.
6 changes: 3 additions & 3 deletions src/file_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::fs;
use std::path::{Path, PathBuf};

use crate::error::{ScaffoldError, ScaffoldResult};
use crate::utils::unparse;
use crate::utils::unparse_pretty;

pub type FileTree = FileSystemTree<OsString, String>;

Expand Down Expand Up @@ -194,10 +194,10 @@ pub fn map_rust_files<F: Fn(PathBuf, syn::File) -> ScaffoldResult<syn::File> + C
let original_file: syn::File = syn::parse_str(&contents)
.map_err(|e| ScaffoldError::MalformedFile(file_path.clone(), e.to_string()))?;
let new_file = map_fn(file_path, original_file.clone())?;
// Only reformat the file via unparse if the contents of the newly modified
// Only reformat the file via unparse_pretty if the contents of the newly modified
// file are different from the original
if new_file != original_file {
return Ok(unparse(&new_file));
return Ok(unparse_pretty(&new_file));
}
}
}
Expand Down
Loading

0 comments on commit 75dfad2

Please sign in to comment.