From 98a02a73a44dc25cd2c34bbe92f5cbbb88a8f66f Mon Sep 17 00:00:00 2001 From: philippeitis <33013301+philippeitis@users.noreply.github.com> Date: Mon, 10 Oct 2022 17:14:43 -0700 Subject: [PATCH] Simplify searching for "alt=json" param --- src/generator/templates/api/lib/mbuild.mako | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/generator/templates/api/lib/mbuild.mako b/src/generator/templates/api/lib/mbuild.mako index 42bc244b12..18654c9c22 100644 --- a/src/generator/templates/api/lib/mbuild.mako +++ b/src/generator/templates/api/lib/mbuild.mako @@ -582,17 +582,15 @@ match result { % if supports_download: let (json_field_missing, enable_resource_parsing) = { let mut enable = true; - let mut field_present = true; + let mut field_missing = true; for &(name, ref value) in params.iter() { if name == "alt" { - field_present = false; - if >::as_ref(&value) != "json" { - enable = false; - } + field_missing = false; + enable = value == "json"; break; } } - (field_present, enable) + (field_missing, enable) }; if json_field_missing { params.push(("alt", "json".to_string()));