Merge pull request #1267 from gwenn/clippy

[breaking change] Update edition from 2018 to 2021
This commit is contained in:
gwenn
2023-06-17 07:44:02 +02:00
committed by GitHub
15 changed files with 45 additions and 71 deletions

View File

@@ -113,10 +113,7 @@ unsafe impl<'vtab> VTab<'vtab> for CsvTab {
match param {
"filename" => {
if !Path::new(value).exists() {
return Err(Error::ModuleError(format!(
"file '{}' does not exist",
value
)));
return Err(Error::ModuleError(format!("file '{value}' does not exist")));
}
vtab.filename = value.to_owned();
}
@@ -137,8 +134,7 @@ unsafe impl<'vtab> VTab<'vtab> for CsvTab {
n_col = Some(n);
} else {
return Err(Error::ModuleError(format!(
"unrecognized argument to 'columns': {}",
value
"unrecognized argument to 'columns': {value}"
)));
}
}
@@ -147,8 +143,7 @@ unsafe impl<'vtab> VTab<'vtab> for CsvTab {
vtab.has_headers = b;
} else {
return Err(Error::ModuleError(format!(
"unrecognized argument to 'header': {}",
value
"unrecognized argument to 'header': {value}"
)));
}
}
@@ -157,8 +152,7 @@ unsafe impl<'vtab> VTab<'vtab> for CsvTab {
vtab.delimiter = b;
} else {
return Err(Error::ModuleError(format!(
"unrecognized argument to 'delimiter': {}",
value
"unrecognized argument to 'delimiter': {value}"
)));
}
}
@@ -171,15 +165,13 @@ unsafe impl<'vtab> VTab<'vtab> for CsvTab {
}
} else {
return Err(Error::ModuleError(format!(
"unrecognized argument to 'quote': {}",
value
"unrecognized argument to 'quote': {value}"
)));
}
}
_ => {
return Err(Error::ModuleError(format!(
"unrecognized parameter '{}'",
param
"unrecognized parameter '{param}'"
)));
}
}
@@ -326,8 +318,7 @@ unsafe impl VTabCursor for CsvTabCursor<'_> {
fn column(&self, ctx: &mut Context, col: c_int) -> Result<()> {
if col < 0 || col as usize >= self.cols.len() {
return Err(Error::ModuleError(format!(
"column index out of bounds: {}",
col
"column index out of bounds: {col}"
)));
}
if self.cols.is_empty() {

View File

@@ -56,8 +56,7 @@ impl VTabLog {
"schema" => {
if schema.is_some() {
return Err(Error::ModuleError(format!(
"more than one '{}' parameter",
param
"more than one '{param}' parameter"
)));
}
schema = Some(value.to_owned())
@@ -65,8 +64,7 @@ impl VTabLog {
"rows" => {
if n_row.is_some() {
return Err(Error::ModuleError(format!(
"more than one '{}' parameter",
param
"more than one '{param}' parameter"
)));
}
if let Ok(n) = i64::from_str(value) {
@@ -75,8 +73,7 @@ impl VTabLog {
}
_ => {
return Err(Error::ModuleError(format!(
"unrecognized parameter '{}'",
param
"unrecognized parameter '{param}'"
)));
}
}