Skip to content

Commit

Permalink
review: replace Option<String> -> String type of `Nep330BuildInfo…
Browse files Browse the repository at this point in the history
….contract_path`
  • Loading branch information
dj8yfo committed May 10, 2024
1 parent 74f86d9 commit ca13500
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions cargo-near/src/commands/build_command/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const RUST_LOG_EXPORT: &str = "RUST_LOG=cargo_near=info";

struct Nep330BuildInfo {
build_environment: String,
contract_path: Option<String>,
contract_path: String,
source_code_snapshot: source_id::SourceId,
}

Expand All @@ -330,11 +330,6 @@ impl Nep330BuildInfo {
.to_str()
.wrap_err("non UTF-8 unix path computed as contract path")?
.to_string();
let contract_path = if contract_path.is_empty() {
None
} else {
Some(contract_path)
};

let source_code_snapshot = source_id::SourceId::for_git(
&docker_build_meta.source_code_git_url,
Expand All @@ -360,12 +355,10 @@ impl Nep330BuildInfo {
),
];

if let Some(ref contract_path) = self.contract_path {
result.extend(vec![
"--env".to_string(),
format!("{}={}", CONTRACT_PATH_ENV_KEY, contract_path),
]);
}
result.extend(vec![
"--env".to_string(),
format!("{}={}", CONTRACT_PATH_ENV_KEY, self.contract_path),
]);

result
}
Expand Down

0 comments on commit ca13500

Please sign in to comment.