Skip to content

Commit

Permalink
Remove unused self args
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Sep 5, 2024
1 parent 2123d77 commit 08c97b0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Runner {
})?;

// clone the template repo into the temp dir
self.clone_repo(&self.args.frontend_template, fe_template_dir.path())?;
Self::clone_repo(&self.args.frontend_template, fe_template_dir.path())?;

// copy the frontend template files into the project
self.copy_frontend_files(fe_template_dir.path(), &project_path)?;
Expand All @@ -144,7 +144,7 @@ impl Runner {
})?;

// clone the soroban-examples repo into the temp dir
self.clone_repo(SOROBAN_EXAMPLES_URL, examples_dir.path())?;
Self::clone_repo(SOROBAN_EXAMPLES_URL, examples_dir.path())?;

// copy the example contracts into the project
self.copy_example_contracts(
Expand Down Expand Up @@ -280,7 +280,7 @@ impl Runner {
!self.args.with_example.is_empty()
}

fn clone_repo(&self, from_url: &str, to_path: &Path) -> Result<(), Error> {
fn clone_repo(from_url: &str, to_path: &Path) -> Result<(), Error> {
let mut prepare = clone::PrepareFetch::new(
from_url,
to_path,
Expand Down Expand Up @@ -323,13 +323,13 @@ impl Runner {
Self::create_dir_all(&to_contract_path)?;

self.copy_contents(&from_contract_path, &to_contract_path)?;
self.edit_contract_cargo_file(&to_contract_path)?;
Self::edit_contract_cargo_file(&to_contract_path)?;
}

Ok(())
}

fn edit_contract_cargo_file(&self, contract_path: &Path) -> Result<(), Error> {
fn edit_contract_cargo_file(contract_path: &Path) -> Result<(), Error> {
let cargo_path = contract_path.join("Cargo.toml");

let cargo_toml_str = Self::read_to_string(&cargo_path)?;
Expand Down Expand Up @@ -357,10 +357,10 @@ impl Runner {
fn copy_frontend_files(&self, from: &Path, to: &Path) -> Result<(), Error> {
self.print.infoln("Initializing with frontend template");
self.copy_contents(from, to)?;
self.edit_package_json_files(to)
Self::edit_package_json_files(to)
}

fn edit_package_json_files(&self, project_path: &Path) -> Result<(), Error> {
fn edit_package_json_files(project_path: &Path) -> Result<(), Error> {
let package_name = if let Some(name) = project_path.file_name() {
name.to_owned()
} else {
Expand All @@ -373,12 +373,11 @@ impl Runner {
file_name
};

self.edit_package_name(project_path, &package_name, "package.json")?;
self.edit_package_name(project_path, &package_name, "package-lock.json")
Self::edit_package_name(project_path, &package_name, "package.json")?;
Self::edit_package_name(project_path, &package_name, "package-lock.json")
}

fn edit_package_name(
&self,
project_path: &Path,
package_name: &OsStr,
file_name: &str,
Expand Down

0 comments on commit 08c97b0

Please sign in to comment.