diff --git a/api/cpp/build.rs b/api/cpp/build.rs index 92f427c90c..890c3961b7 100644 --- a/api/cpp/build.rs +++ b/api/cpp/build.rs @@ -9,10 +9,9 @@ fn main() -> Result<(), anyhow::Error> { let manifest_dir = std::env::var_os("CARGO_MANIFEST_DIR").unwrap(); // Go from $root/api/cpp down to $root - let root_dir = Path::new(&manifest_dir).ancestors().nth(2).expect(&format!( - "Failed to locate root directory, relative to {}", - manifest_dir.to_string_lossy() - )); + let root_dir = Path::new(&manifest_dir).ancestors().nth(2).unwrap_or_else(|| { + panic!("Failed to locate root directory, relative to {}", manifest_dir.to_string_lossy()) + }); println!("cargo:rerun-if-env-changed=SLINT_GENERATED_INCLUDE_DIR"); let output_dir = std::env::var_os("SLINT_GENERATED_INCLUDE_DIR").unwrap_or_else(|| { diff --git a/api/cpp/lib.rs b/api/cpp/lib.rs index e5834901b1..605869b647 100644 --- a/api/cpp/lib.rs +++ b/api/cpp/lib.rs @@ -247,11 +247,11 @@ pub extern "C" fn slint_open_url(url: &SharedString) { #[unsafe(no_mangle)] pub extern "C" fn slint_escape_markdown(text: &mut SharedString) -> &SharedString { - *text = i_slint_core::escape_markdown(&text).into(); + *text = i_slint_core::escape_markdown(text).into(); text } #[unsafe(no_mangle)] pub extern "C" fn slint_parse_markdown(text: &SharedString, out: &mut StyledText) { - *out = i_slint_core::parse_markdown(&text); + *out = i_slint_core::parse_markdown(text); } diff --git a/internal/compiler/passes/lower_timers.rs b/internal/compiler/passes/lower_timers.rs index b350bdbdab..45734f68fb 100644 --- a/internal/compiler/passes/lower_timers.rs +++ b/internal/compiler/passes/lower_timers.rs @@ -12,8 +12,8 @@ use std::rc::Rc; pub fn lower_timers(component: &Rc, diag: &mut BuildDiagnostics) { visit_all_expressions(component, |e, _| { - e.visit_recursive_mut(&mut |e| match e { - Expression::FunctionCall { function, arguments, .. } => { + e.visit_recursive_mut(&mut |e| { + if let Expression::FunctionCall { function, arguments, .. } = e { if let Callable::Builtin(BuiltinFunction::StartTimer | BuiltinFunction::StopTimer) = function && let [Expression::ElementReference(timer)] = arguments.as_slice() @@ -32,7 +32,6 @@ pub fn lower_timers(component: &Rc, diag: &mut BuildDiagnostics) { } } } - _ => {} }); });