Skip to content

Commit a8a1f73

Browse files
committed
Fix clippy errors
1 parent 56a0046 commit a8a1f73

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

chromiumoxide_pdl/src/build/generator.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22
use std::collections::{HashMap, HashSet, VecDeque};
33
use std::fs;
4-
use std::io::{self, Error, ErrorKind};
4+
use std::io::{self, Error};
55
use std::ops::Deref;
66
use std::path::{Path, PathBuf};
77

@@ -163,9 +163,7 @@ impl Generator {
163163
pub fn compile_pdls<P: AsRef<Path>>(&mut self, pdls: &[P]) -> io::Result<()> {
164164
let target: PathBuf = self.out_dir.clone().map(Ok).unwrap_or_else(|| {
165165
std::env::var_os("OUT_DIR")
166-
.ok_or_else(|| {
167-
Error::new(ErrorKind::Other, "OUT_DIR environment variable is not set")
168-
})
166+
.ok_or_else(|| Error::other("OUT_DIR environment variable is not set"))
169167
.map(Into::into)
170168
})?;
171169

@@ -174,24 +172,20 @@ impl Generator {
174172
for path in pdls {
175173
let path = path.as_ref();
176174
let file_name = path.file_stem().ok_or_else(|| {
177-
Error::new(
178-
ErrorKind::Other,
179-
format!("Failed to read file name for {}", path.display()),
180-
)
175+
Error::other(format!("Failed to read file name for {}", path.display()))
181176
})?;
182177
let mod_name = file_name.to_string_lossy().to_string();
183178
self.protocol_mods.push(mod_name);
184179

185180
let input = fs::read_to_string(path)?;
186-
let resolved =
187-
resolve_pdl(path, &input).map_err(|e| Error::new(ErrorKind::Other, e.message))?;
181+
let resolved = resolve_pdl(path, &input).map_err(|e| Error::other(e.message))?;
188182
inputs.push(resolved);
189183
}
190184

191185
let mut protocols = vec![];
192186

193187
for (idx, input) in inputs.iter().enumerate() {
194-
let pdl = parse_pdl(input).map_err(|e| Error::new(ErrorKind::Other, e.message))?;
188+
let pdl = parse_pdl(input).map_err(|e| Error::other(e.message))?;
195189

196190
self.domains
197191
.extend(pdl.domains.iter().map(|d| (d.name.to_string(), idx)));

0 commit comments

Comments
 (0)