Skip to content

Commit 4f18fe6

Browse files
committed
Use Self::Error in Load implementations.
1 parent 1d2b871 commit 4f18fe6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/fragment.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,14 @@ impl Load for Fragment<'_> {
350350
fn load<P: AsRef<Path>>(path: P) -> Result<Self, Self::Error> {
351351
let path = path.as_ref();
352352

353-
let name = path_name(path).ok_or_else(|| Error::new_invalid_utf8(path.to_owned()))?;
353+
let name = path_name(path).ok_or_else(|| Self::Error::new_invalid_utf8(path.to_owned()))?;
354354

355355
let info = name
356356
.parse()
357-
.map_err(|error| Error::parse(error, path.to_owned()))?;
357+
.map_err(|error| Self::Error::parse(error, path.to_owned()))?;
358358

359359
let content = read_to_string(path)
360-
.map_err(|error| Error::new_read(error, path.to_owned()))?
360+
.map_err(|error| Self::Error::new_read(error, path.to_owned()))?
361361
.trim()
362362
.to_owned();
363363

src/workspace.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ impl Load for Workspace<'_> {
116116
let path = path.as_ref();
117117

118118
let string =
119-
read_to_string(path).map_err(|error| Error::new_read(error, path.to_owned()))?;
119+
read_to_string(path).map_err(|error| Self::Error::new_read(error, path.to_owned()))?;
120120

121-
let workspace =
122-
toml::from_str(&string).map_err(|error| Error::new_parse(error, path.to_owned()))?;
121+
let workspace = toml::from_str(&string)
122+
.map_err(|error| Self::Error::new_parse(error, path.to_owned()))?;
123123

124124
Ok(workspace)
125125
}
@@ -146,10 +146,10 @@ impl Load for PyProject<'_> {
146146
let path = path.as_ref();
147147

148148
let string =
149-
read_to_string(path).map_err(|error| Error::new_read(error, path.to_owned()))?;
149+
read_to_string(path).map_err(|error| Self::Error::new_read(error, path.to_owned()))?;
150150

151-
let workspace =
152-
toml::from_str(&string).map_err(|error| Error::new_parse(error, path.to_owned()))?;
151+
let workspace = toml::from_str(&string)
152+
.map_err(|error| Self::Error::new_parse(error, path.to_owned()))?;
153153

154154
Ok(workspace)
155155
}

0 commit comments

Comments
 (0)