Skip to content

Commit 458fa38

Browse files
Merge pull request #21992 from BenjaminBrienen/view-crate-graph-unwrap
unwrap unnecessary result return type in view_crate_graph
2 parents c3a4b78 + 5a19a17 commit 458fa38

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

crates/ide/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl Analysis {
414414
}
415415

416416
/// Renders the crate graph to GraphViz "dot" syntax.
417-
pub fn view_crate_graph(&self, full: bool) -> Cancellable<Result<String, String>> {
417+
pub fn view_crate_graph(&self, full: bool) -> Cancellable<String> {
418418
self.with_db(|db| view_crate_graph::view_crate_graph(db, full))
419419
}
420420

crates/ide/src/view_crate_graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ide_db::{
1616
// | Editor | Action Name |
1717
// |---------|-------------|
1818
// | VS Code | **rust-analyzer: View Crate Graph** |
19-
pub(crate) fn view_crate_graph(db: &RootDatabase, full: bool) -> Result<String, String> {
19+
pub(crate) fn view_crate_graph(db: &RootDatabase, full: bool) -> String {
2020
let all_crates = all_crates(db);
2121
let crates_to_render = all_crates
2222
.iter()
@@ -36,7 +36,7 @@ pub(crate) fn view_crate_graph(db: &RootDatabase, full: bool) -> Result<String,
3636

3737
let mut dot = Vec::new();
3838
dot::render(&graph, &mut dot).unwrap();
39-
Ok(String::from_utf8(dot).unwrap())
39+
String::from_utf8(dot).unwrap()
4040
}
4141

4242
struct DotCrateGraph<'db> {

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ pub(crate) fn handle_view_crate_graph(
332332
params: ViewCrateGraphParams,
333333
) -> anyhow::Result<String> {
334334
let _p = tracing::info_span!("handle_view_crate_graph").entered();
335-
let dot = snap.analysis.view_crate_graph(params.full)?.map_err(anyhow::Error::msg)?;
335+
let dot = snap.analysis.view_crate_graph(params.full)?;
336336
Ok(dot)
337337
}
338338

0 commit comments

Comments
 (0)