diff --git a/src/mysql/discovery/mod.rs b/src/mysql/discovery/mod.rs index 9be9a3b7..fcb1964e 100644 --- a/src/mysql/discovery/mod.rs +++ b/src/mysql/discovery/mod.rs @@ -33,11 +33,7 @@ impl SchemaDiscovery { } pub async fn discover(mut self) -> Result { - let system_info = self - .discover_system() - .await - .and_then(|system_info_opt| system_info_opt.ok_or(SqlxError::RowNotFound))?; - self.query = SchemaQueryBuilder::new(system_info); + self.query = SchemaQueryBuilder::new(self.discover_system().await?); let tables = self.discover_tables().await?; let tables = future::try_join_all( tables @@ -54,7 +50,7 @@ impl SchemaDiscovery { }) } - pub async fn discover_system(&mut self) -> Result, SqlxError> { + pub async fn discover_system(&mut self) -> Result { let rows = self.executor.fetch_all(self.query.query_version()).await?; #[allow(clippy::never_loop)] @@ -63,9 +59,9 @@ impl SchemaDiscovery { debug_print!("{:?}", result); let version = result.parse(); debug_print!("{:?}", version); - return Ok(Some(version)); + return Ok(version); } - Ok(None) + Err(SqlxError::RowNotFound) } pub async fn discover_tables(&mut self) -> Result, SqlxError> {