Merge pull request #19180 from joshrotenberg/fix-source-file-url

doc: use fully qualified url for source path
This commit is contained in:
Lukas Wirth 2025-02-19 06:37:01 +00:00 committed by GitHub
commit 1ad2fa8d8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,7 +117,13 @@ impl fmt::Display for Location {
let path = self.file.strip_prefix(project_root()).unwrap().display().to_string();
let path = path.replace('\\', "/");
let name = self.file.file_name().unwrap();
write!(f, " [{}](/{}#{}) ", name.to_str().unwrap(), path, self.line)
write!(
f,
" [{}](https://github.com/rust-lang/rust-analyzer/blob/master/{}#{}) ",
name.to_str().unwrap(),
path,
self.line
)
}
}