Codex created this PR from the following prompt: > upgrade this entire repo to Rust 1.89. Note that this requires updating codex-rs/rust-toolchain.toml as well as the workflows in .github/. Make sure that things are "clippy clean" as this change will likely uncover new Clippy errors. `just fmt` and `cargo clippy --tests` are sufficient to check for correctness Note this modifies a lot of lines because it folds nested `if` statements using `&&`. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2465). * #2467 * __->__ #2465
18 lines
497 B
Rust
18 lines
497 B
Rust
use crate::error::Error;
|
|
use crate::error::Result;
|
|
|
|
pub fn parse_sed_command(sed_command: &str) -> Result<()> {
|
|
// For now, we parse only commands like `122,202p`.
|
|
if let Some(stripped) = sed_command.strip_suffix("p")
|
|
&& let Some((first, rest)) = stripped.split_once(",")
|
|
&& first.parse::<u64>().is_ok()
|
|
&& rest.parse::<u64>().is_ok()
|
|
{
|
|
return Ok(());
|
|
}
|
|
|
|
Err(Error::SedCommandNotProvablySafe {
|
|
command: sed_command.to_string(),
|
|
})
|
|
}
|