diff --git a/internal/compiler/passes/resolving.rs b/internal/compiler/passes/resolving.rs index 1d8173166d48..917172e6fd04 100644 --- a/internal/compiler/passes/resolving.rs +++ b/internal/compiler/passes/resolving.rs @@ -359,17 +359,16 @@ impl Expression { } fn from_at_image_url_node(node: syntax_nodes::AtImageUrl, ctx: &mut LookupCtx) -> Self { - let s = match node - .child_text(SyntaxKind::StringLiteral) - .and_then(|x| - if x.starts_with("\"data:") { - // Remove quotes here because unescape_string() doesn't support \n yet. - let x = x.strip_prefix('"')?; - let x = x.strip_suffix('"')?; - Some(SmolStr::new(x)) - } else { crate::literals::unescape_string(&x) } - ) - { + let s = match node.child_text(SyntaxKind::StringLiteral).and_then(|x| { + if x.starts_with("\"data:") { + // Remove quotes here because unescape_string() doesn't support \n yet. + let x = x.strip_prefix('"')?; + let x = x.strip_suffix('"')?; + Some(SmolStr::new(x)) + } else { + crate::literals::unescape_string(&x) + } + }) { Some(s) => s, None => { ctx.diag.push_error("Cannot parse string literal".into(), &node); diff --git a/internal/core/graphics/image.rs b/internal/core/graphics/image.rs index d947ef373dc2..8dd082a1605b 100644 --- a/internal/core/graphics/image.rs +++ b/internal/core/graphics/image.rs @@ -1284,7 +1284,10 @@ pub(crate) mod ffi { #[cfg(feature = "image-decoders")] #[no_mangle] - pub unsafe extern "C" fn slint_image_load_from_data_url(data_url: &SharedString, image: *mut Image) { + pub unsafe extern "C" fn slint_image_load_from_data_url( + data_url: &SharedString, + image: *mut Image, + ) { core::ptr::write( image, Image::load_from_data_url(data_url.as_str()).unwrap_or(Image::default()),