[gnome-builder] rust-analyzer: handle reaching / gracefully
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] rust-analyzer: handle reaching / gracefully
- Date: Thu, 4 Mar 2021 05:55:07 +0000 (UTC)
commit 732cf3907cecc993efc64770b4758290cbe52fe6
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 3 21:55:02 2021 -0800
rust-analyzer: handle reaching / gracefully
.../rust-analyzer/rust-analyzer-pipeline-addin.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
b/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
index 8bb26ba22..063f7db2c 100644
--- a/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
+++ b/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
@@ -73,17 +73,20 @@ find_cargo_toml_from_file (GFile *file)
if (file != NULL)
{
g_autoptr(GFile) parent = g_file_get_parent (file);
- g_autoptr(GFile) cargo_toml = g_file_get_child (parent, "Cargo.toml");
g_autofree gchar *name = g_file_get_basename (file);
- if (g_strcmp0 (name, "Cargo.toml") == 0)
- return g_steal_pointer (&parent);
+ if (parent != NULL)
+ {
+ g_autoptr(GFile) cargo_toml = g_file_get_child (parent, "Cargo.toml");
- if (g_file_query_exists (cargo_toml, NULL))
- return g_steal_pointer (&cargo_toml);
+ if (g_strcmp0 (name, "Cargo.toml") == 0)
+ return g_steal_pointer (&parent);
- if (parent != NULL)
- return find_cargo_toml_from_file (parent);
+ if (g_file_query_exists (cargo_toml, NULL))
+ return g_steal_pointer (&cargo_toml);
+
+ return find_cargo_toml_from_file (parent);
+ }
}
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]