Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/librustdoc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,26 @@ pub(crate) struct Error {
pub(crate) file: PathBuf,
pub(crate) error: String,
}
//note for that as change some codes here
//Make Changes if You know

impl error::Error for Error {}

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let file = self.file.display().to_string();
if file.is_empty() {
write!(f, "{}", self.error)
if let Some(file) = self.file.to_str() {
if file.is_empty() {
write!(f, "Error: {}", self.error)
} else {
write!(f, "File: \"{}\", Error: {}", file, self.error)
}
} else {
write!(f, "\"{}\": {}", self.file.display(), self.error)
write!(f, "Error: {}", self.error)
}
}
}


impl PathError for Error {
fn new<S, P: AsRef<Path>>(e: S, path: P) -> Error
where
Expand Down
Loading