Fix future clippy linting warnings (#1423)
This commit is contained in:
parent
cef01ad790
commit
a2038f239b
8 changed files with 20 additions and 20 deletions
|
@ -41,10 +41,10 @@ fn backup_http_to_file(matches: &clap::ArgMatches, from: &str, into: &str) -> Re
|
|||
// Parse the specified password
|
||||
let pass = matches.value_of("pass").unwrap();
|
||||
// Set the correct source URL
|
||||
let from = format!("{}/sync", from);
|
||||
let from = format!("{from}/sync");
|
||||
// Try to open the source http
|
||||
let mut from = Client::new()
|
||||
.get(&from)
|
||||
.get(from)
|
||||
.basic_auth(user, Some(pass))
|
||||
.header(CONTENT_TYPE, TYPE)
|
||||
.send()?
|
||||
|
@ -65,10 +65,10 @@ fn backup_file_to_http(matches: &clap::ArgMatches, from: &str, into: &str) -> Re
|
|||
// Try to open the source file
|
||||
let from = OpenOptions::new().read(true).open(from)?;
|
||||
// Set the correct output URL
|
||||
let into = format!("{}/sync", into);
|
||||
let into = format!("{into}/sync");
|
||||
// Copy the data to the destination
|
||||
Client::new()
|
||||
.post(&into)
|
||||
.post(into)
|
||||
.basic_auth(user, Some(pass))
|
||||
.header(CONTENT_TYPE, TYPE)
|
||||
.body(from)
|
||||
|
@ -84,19 +84,19 @@ fn backup_http_to_http(matches: &clap::ArgMatches, from: &str, into: &str) -> Re
|
|||
// Parse the specified password
|
||||
let pass = matches.value_of("pass").unwrap();
|
||||
// Set the correct source URL
|
||||
let from = format!("{}/sync", from);
|
||||
let from = format!("{from}/sync");
|
||||
// Set the correct output URL
|
||||
let into = format!("{}/sync", into);
|
||||
let into = format!("{into}/sync");
|
||||
// Try to open the source file
|
||||
let from = Client::new()
|
||||
.get(&from)
|
||||
.get(from)
|
||||
.basic_auth(user, Some(pass))
|
||||
.header(CONTENT_TYPE, TYPE)
|
||||
.send()?
|
||||
.error_for_status()?;
|
||||
// Copy the data to the destination
|
||||
Client::new()
|
||||
.post(&into)
|
||||
.post(into)
|
||||
.basic_auth(user, Some(pass))
|
||||
.header(CONTENT_TYPE, TYPE)
|
||||
.body(Body::new(from))
|
||||
|
|
|
@ -18,10 +18,10 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
|
|||
let ns = matches.value_of("ns").unwrap();
|
||||
let db = matches.value_of("db").unwrap();
|
||||
// Set the correct export URL
|
||||
let conn = format!("{}/export", conn);
|
||||
let conn = format!("{conn}/export");
|
||||
// Export the data from the database
|
||||
let mut res = Client::new()
|
||||
.get(&conn)
|
||||
.get(conn)
|
||||
.header(ACCEPT, "application/octet-stream")
|
||||
.basic_auth(user, Some(pass))
|
||||
.header("NS", ns)
|
||||
|
|
|
@ -22,10 +22,10 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
|
|||
let ns = matches.value_of("ns").unwrap();
|
||||
let db = matches.value_of("db").unwrap();
|
||||
// Set the correct import URL
|
||||
let conn = format!("{}/import", conn);
|
||||
let conn = format!("{conn}/import");
|
||||
// Import the data into the database
|
||||
let res = Client::new()
|
||||
.post(&conn)
|
||||
.post(conn)
|
||||
.header(ACCEPT, "application/octet-stream")
|
||||
.basic_auth(user, Some(pass))
|
||||
.header("NS", ns)
|
||||
|
|
|
@ -19,7 +19,7 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
|
|||
// If we should pretty-print responses
|
||||
let pretty = matches.is_present("pretty");
|
||||
// Set the correct import URL
|
||||
let conn = format!("{}/sql", conn);
|
||||
let conn = format!("{conn}/sql");
|
||||
// Create a new terminal REPL
|
||||
let mut rl = Editor::<()>::new().unwrap();
|
||||
// Load the command-line history
|
||||
|
@ -57,8 +57,8 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
|
|||
let res = res.body(line).send();
|
||||
// Get the request response
|
||||
match process(pretty, res) {
|
||||
Ok(v) => println!("{}", v),
|
||||
Err(e) => eprintln!("{}", e),
|
||||
Ok(v) => println!("{v}"),
|
||||
Err(e) => eprintln!("{e}"),
|
||||
}
|
||||
}
|
||||
// The user types CTRL-C
|
||||
|
@ -71,7 +71,7 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
|
|||
}
|
||||
// There was en error
|
||||
Err(err) => {
|
||||
eprintln!("Error: {:?}", err);
|
||||
eprintln!("Error: {err:?}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ pub async fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
|
|||
_ => unreachable!(),
|
||||
};
|
||||
// Output SurrealDB logo
|
||||
println!("{}", LOGO);
|
||||
println!("{LOGO}");
|
||||
// Setup the cli options
|
||||
config::init(matches);
|
||||
// Initiate environment
|
||||
|
|
|
@ -9,7 +9,7 @@ const SERVER: &str = "Server";
|
|||
const VERSION: &str = "Version";
|
||||
|
||||
pub fn version() -> warp::filters::reply::WithHeader {
|
||||
let val = format!("{}-{}", PKG_NAME, *PKG_VERSION);
|
||||
let val = format!("{PKG_NAME}-{}", *PKG_VERSION);
|
||||
warp::reply::with::header(VERSION, val)
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ impl Rpc {
|
|||
},
|
||||
// Get the current server version
|
||||
"version" => match params.len() {
|
||||
0 => Ok(format!("{}-{}", PKG_NAME, *PKG_VERSION).into()),
|
||||
0 => Ok(format!("{PKG_NAME}-{}", *PKG_VERSION).into()),
|
||||
_ => return res::failure(id, Failure::INVALID_PARAMS).send(out, chn).await,
|
||||
},
|
||||
// Run a full SurrealQL query against the database
|
||||
|
|
|
@ -8,6 +8,6 @@ pub fn config() -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejecti
|
|||
}
|
||||
|
||||
pub async fn handler() -> Result<impl warp::Reply, warp::Rejection> {
|
||||
let val = format!("{}-{}", PKG_NAME, *PKG_VERSION);
|
||||
let val = format!("{PKG_NAME}-{}", *PKG_VERSION);
|
||||
Ok(warp::reply::with_status(val, http::StatusCode::OK))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue