Skip to content

Commit d7a86a6

Browse files
authored
Simplify use of io::Error::other (#276)
## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective The new `io::Error::other` function to create an `Other` variant is available since rust 1.74 and clippy was linting it as a recommendation. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 9502e4e commit d7a86a6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

crates/bitwarden-wasm-internal/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ fn main() {
1111
}
1212

1313
fn run(args: &[&str]) -> Result<String, std::io::Error> {
14-
use std::io::{Error, ErrorKind};
14+
use std::io::Error;
1515
let out = Command::new(args[0]).args(&args[1..]).output()?;
1616
if !out.status.success() {
17-
return Err(Error::new(ErrorKind::Other, "Command not successful"));
17+
return Err(Error::other("Command not successful"));
1818
}
1919
Ok(String::from_utf8(out.stdout)
20-
.map_err(|e| Error::new(ErrorKind::Other, e.to_string()))?
20+
.map_err(Error::other)?
2121
.trim()
2222
.to_string())
2323
}

crates/memory-testing/src/bin/capture-dumps.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ fn dump_process_to_bytearray(pid: u32, output_dir: &Path, output_name: &Path) ->
1111
.output()?;
1212

1313
if !output.status.success() {
14-
return io::Result::Err(io::Error::new(
15-
io::ErrorKind::Other,
16-
format!("Failed to dump process: {:?}", output),
17-
));
14+
return io::Result::Err(io::Error::other(format!(
15+
"Failed to dump process: {:?}",
16+
output
17+
)));
1818
}
1919

2020
let core_path = format!("core.{}", pid);

0 commit comments

Comments
 (0)