Skip to content

Commit

Permalink
Merge pull request #42 from afazekas/no-clone-state
Browse files Browse the repository at this point in the history
No need to clone state
  • Loading branch information
igor-petruk authored Jan 2, 2024
2 parents 18725b0 + 48583c7 commit 2907e61
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@ impl BuildSpec {
for (line_num, line) in reader.lines().enumerate() {
let mut line = line.context(format!("Cannot parse script line: {}", line_num))?;
script_src.push(line.clone());
let old_state = state.clone();
state = match old_state {
state = match state {
ScriptSource => {
let sb_start = line.find("scriptisto-begin");
if let Some(pos) = sb_start {
ConfigSource { prefix_len: pos }
} else {
old_state
state
}
}
ConfigSource { prefix_len } => {
Expand All @@ -91,7 +90,7 @@ impl BuildSpec {
ScriptSource
} else {
cfg_src.push(line);
old_state
state
}
}
};
Expand Down

0 comments on commit 2907e61

Please sign in to comment.