Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 24, 2024
1 parent 9eaa9c3 commit e7a931b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
21 changes: 10 additions & 11 deletions internal/compiler/passes/resolving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion internal/core/graphics/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down

0 comments on commit e7a931b

Please sign in to comment.