Repository: libsql/libsql
File: libsql-server/src/connection/libsql.rs (Rust)

Code before:

impl<W: Wal> Connection<W> {
    fn new<T: WalManager<Wal = W>>(
        path: &Path,
        extensions: Arc<[PathBuf]>,
        wal_manager: T,
        stats: Arc<Stats>,
        broadcaster: BroadcasterHandle,
        config_store: MetaStoreHandle,
        builder_config: QueryBuilderConfig,
        current_frame_no_receiver: watch::Receiver<Option<FrameNo>>,
        block_writes: Arc<AtomicBool>,
        resolve_attach_path: ResolveNamespacePathFn,
    ) -> Result<Self> {
        let conn = open_conn_active_checkpoint(
            path,
            wal_manager,
            None,
            builder_config.auto_checkpoint,
            builder_config.encryption_config.clone(),
        )?;

        let config = config_store.get();
        conn.pragma_update(None, "max_page_count", config.max_db_pages)?;
        if let Some(mode) = config.durability_mode {
            tracing::info!("setting PRAGMA synchronous to {:?}", mode);
            conn.pragma_update(None, "synchronous", mode)?;
        }
        conn.set_limit(
            rusqlite::limits::Limit::SQLITE_LIMIT_LENGTH,
            config.max_row_size as i32,
        );

        unsafe {
            const MAX_RETRIES: c_int = 8;
            extern "C" fn do_nothing(_: *mut c_void, n: c_int) -> c_int {
                (n < MAX_RETRIES) as _
            }
            libsql_sys::ffi::sqlite3_busy_handler(
                conn.handle(),
                Some(do_nothing),
                std::ptr::null_mut(),
            );
        }

        let this = Self {
            conn,
            stats,
            config_store,
            builder_config,
            current_frame_no_receiver,

Review comment (suggestion):
```suggestion
            tracing::info!("setting PRAGMA synchronous to {mode:?}");
```
Clippy is gonna complain

Code after:

impl<W: Wal> Connection<W> {
    fn new<T: WalManager<Wal = W>>(
        path: &Path,
        extensions: Arc<[PathBuf]>,
        wal_manager: T,
        stats: Arc<Stats>,
        broadcaster: BroadcasterHandle,
        config_store: MetaStoreHandle,
        builder_config: QueryBuilderConfig,
        current_frame_no_receiver: watch::Receiver<Option<FrameNo>>,
        block_writes: Arc<AtomicBool>,
        resolve_attach_path: ResolveNamespacePathFn,
    ) -> Result<Self> {
        let conn = open_conn_active_checkpoint(
            path,
            wal_manager,
            None,
            builder_config.auto_checkpoint,
            builder_config.encryption_config.clone(),
        )?;

        let config = config_store.get();
        conn.pragma_update(None, "max_page_count", config.max_db_pages)?;
        tracing::info!("setting PRAGMA synchronous to {}", config.durability_mode);
        conn.pragma_update(None, "synchronous", config.durability_mode)?;

        conn.set_limit(
            rusqlite::limits::Limit::SQLITE_LIMIT_LENGTH,
            config.max_row_size as i32,
        );

        unsafe {
            const MAX_RETRIES: c_int = 8;
            extern "C" fn do_nothing(_: *mut c_void, n: c_int) -> c_int {
                (n < MAX_RETRIES) as _
            }
            libsql_sys::ffi::sqlite3_busy_handler(
                conn.handle(),
                Some(do_nothing),
                std::ptr::null_mut(),
            );
        }

        let this = Self {
            conn,
            stats,
            config_store,
            builder_config,
            current_frame_no_receiver,
            block_writes,