Skip to content

Commit

Permalink
Release 0.1.7: remove last unwraps from codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnhodgkin committed Oct 2, 2024
1 parent e269cf5 commit da165e3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-purs-gql"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
default-run = "pursgql"
repository = "https://github.com/OxfordAbstracts/purescript-graphql-schema-gen"
Expand Down
2 changes: 1 addition & 1 deletion src/config/parse_outside_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn to_type_value(type_value: &String, types_fn: &impl Fn(&str, &str) -> Option<M
.last()
.expect(&format!("No type value found after '=' for: {type_value}.")),
)
.unwrap_or_else(|| panic!("Type not found: {}", type_value))
.expect(&format!("Type not found: {}", type_value))
} else if type_value.contains(", ") {
let mut values = type_value.split(", ");
let name = values
Expand Down
8 changes: 6 additions & 2 deletions src/hasura_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ fn outside_type(
new_object = object;
}
Some(suffix) => {
new_object = object.strip_suffix(suffix).unwrap();
new_object = object
.strip_suffix(suffix)
.expect("Failed to strip suffix that was found.");
for prefix in MODULE_PREFIXES.iter() {
if new_object.starts_with(prefix) {
new_object = new_object.strip_prefix(prefix).unwrap(); // TODO This needs to happen separately. Still needs to be run even without a suffix
new_object = new_object
.strip_prefix(prefix)
.expect("Failed to strip prefix that was found."); // TODO This needs to happen separately. Still needs to be run even without a suffix
}
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/main_check_needs_migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ async fn main() -> Result<()> {
let migrations: Value = serde_json::from_str(&standard_result.migrations).expect(
"Failed to parse hasura migrations json. Perhaps your Hasura version is mismatched.",
);
let test_migrations: Value = serde_json::from_str(&test_result.migrations).unwrap();
let test_migrations: Value = serde_json::from_str(&test_result.migrations)
.expect("Failed to parse test migrations json.");

let migrations_obj = migrations.as_object().unwrap();
let test_migrations_obj = test_migrations.as_object().unwrap();
let migrations_obj = migrations
.as_object()
.expect("Failed to parse hasura migrations as an object.");
let test_migrations_obj = test_migrations
.as_object()
.expect("Failed to parse test migrations as an object.");

for (k, _) in test_migrations_obj.iter() {
if !migrations_obj.contains_key(k) {
Expand Down

0 comments on commit da165e3

Please sign in to comment.