diff --git a/Cargo.lock b/Cargo.lock index 5c377c4a..4b1467e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1135,135 +1135,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea8a8b81cacc08888170eef4d13b775126db426d0b348bee9d18c2c1eaf123cf" -[[package]] -name = "gel-cli" -version = "6.2.0-dev" -dependencies = [ - "anes", - "ansi-escapes", - "anyhow", - "arc-swap", - "assert_cmd", - "async-listen", - "backtrace", - "base32", - "base64 0.22.1", - "bigdecimal", - "bitflags 2.8.0", - "bitvec", - "blake2b_simd", - "blake3", - "bytes", - "bzip2 0.5.0", - "chrono", - "clap", - "clap_complete", - "codespan-reporting", - "color-print", - "colorful", - "combine", - "concolor", - "const_format", - "crossbeam-utils", - "ctrlc", - "dirs", - "dissimilar", - "downcast-rs", - "edgedb-cli-derive", - "edgeql-parser", - "env_logger", - "fd-lock", - "fn-error-context", - "fs-err", - "fs_extra", - "futures-util", - "gel-derive", - "gel-errors", - "gel-protocol", - "gel-tokio", - "geozero", - "gethostname", - "globset", - "hex", - "humantime", - "humantime-serde", - "immutable-chunkmap", - "indexmap", - "indicatif", - "is-terminal", - "libc", - "libflate", - "log", - "minimad", - "nix 0.29.0", - "nom", - "notify", - "num-bigint", - "once_cell", - "open", - "openssl", - "openssl-sys", - "os-release", - "pem", - "predicates", - "pretty_assertions", - "prettytable-rs", - "rand", - "regex", - "renamore", - "reqwest", - "reqwest-middleware", - "reqwest-retry", - "rexpect", - "ring", - "rpassword", - "rustls 0.23.22", - "rustyline", - "scram", - "semver", - "serde", - "serde_json", - "serde_millis", - "serde_path_to_error", - "serde_str", - "sha1", - "sha2", - "shell-escape", - "shutdown_hooks", - "signal-hook", - "snafu", - "strsim", - "tar", - "tempfile", - "term 1.0.1", - "termcolor", - "termimad", - "terminal-light", - "terminal_size", - "test-case", - "test-utils", - "textwrap", - "thiserror 2.0.11", - "tokio", - "tokio-stream", - "toml", - "tracing", - "unicode-segmentation", - "unicode-width 0.1.14", - "url", - "urlencoding", - "uuid", - "wait-timeout", - "warp", - "which", - "whoami", - "winapi", - "winreg", - "wslapi", - "zip", - "zstd", -] - [[package]] name = "edgedb-cli-derive" version = "0.4.0" @@ -1619,6 +1490,135 @@ dependencies = [ "slab", ] +[[package]] +name = "gel-cli" +version = "6.2.0-dev" +dependencies = [ + "anes", + "ansi-escapes", + "anyhow", + "arc-swap", + "assert_cmd", + "async-listen", + "backtrace", + "base32", + "base64 0.22.1", + "bigdecimal", + "bitflags 2.8.0", + "bitvec", + "blake2b_simd", + "blake3", + "bytes", + "bzip2 0.5.0", + "chrono", + "clap", + "clap_complete", + "codespan-reporting", + "color-print", + "colorful", + "combine", + "concolor", + "const_format", + "crossbeam-utils", + "ctrlc", + "dirs", + "dissimilar", + "downcast-rs", + "edgedb-cli-derive", + "edgeql-parser", + "env_logger", + "fd-lock", + "fn-error-context", + "fs-err", + "fs_extra", + "futures-util", + "gel-derive", + "gel-errors", + "gel-protocol", + "gel-tokio", + "geozero", + "gethostname", + "globset", + "hex", + "humantime", + "humantime-serde", + "immutable-chunkmap", + "indexmap", + "indicatif", + "is-terminal", + "libc", + "libflate", + "log", + "minimad", + "nix 0.29.0", + "nom", + "notify", + "num-bigint", + "once_cell", + "open", + "openssl", + "openssl-sys", + "os-release", + "pem", + "predicates", + "pretty_assertions", + "prettytable-rs", + "rand", + "regex", + "renamore", + "reqwest", + "reqwest-middleware", + "reqwest-retry", + "rexpect", + "ring", + "rpassword", + "rustls 0.23.22", + "rustyline", + "scram", + "semver", + "serde", + "serde_json", + "serde_millis", + "serde_path_to_error", + "serde_str", + "sha1", + "sha2", + "shell-escape", + "shutdown_hooks", + "signal-hook", + "snafu", + "strsim", + "tar", + "tempfile", + "term 1.0.1", + "termcolor", + "termimad", + "terminal-light", + "terminal_size", + "test-case", + "test-utils", + "textwrap", + "thiserror 2.0.11", + "tokio", + "tokio-stream", + "toml", + "tracing", + "unicode-segmentation", + "unicode-width 0.1.14", + "url", + "urlencoding", + "uuid", + "wait-timeout", + "warp", + "which", + "whoami", + "winapi", + "winreg", + "wslapi", + "zip", + "zstd", +] + [[package]] name = "gel-derive" version = "0.6.0" diff --git a/edgedb-cli-derive/src/attrib.rs b/edgedb-cli-derive/src/attrib.rs index 820f3898..56aea809 100644 --- a/edgedb-cli-derive/src/attrib.rs +++ b/edgedb-cli-derive/src/attrib.rs @@ -411,7 +411,7 @@ impl TryFrom for Case { _ => { return Err(syn::Error::new_spanned( s, - format!("undefined case conversion"), + "undefined case conversion".to_string(), )); } }; diff --git a/src/analyze/mod.rs b/src/analyze/mod.rs index f6b08bcc..76d418d4 100644 --- a/src/analyze/mod.rs +++ b/src/analyze/mod.rs @@ -141,7 +141,7 @@ pub async fn command(cli: &mut Connection, options: &Analyze) -> anyhow::Result< } else { let jd = &mut serde_json::Deserializer::from_str(&data); let output = serde_path_to_error::deserialize(jd) - .with_context(|| format!("parsing explain output"))?; + .with_context(|| "parsing explain output".to_string())?; let output = contexts::preprocess(output); render_explain(&output)?; diff --git a/src/cli/install.rs b/src/cli/install.rs index ed843ae6..08e20e05 100644 --- a/src/cli/install.rs +++ b/src/cli/install.rs @@ -155,11 +155,11 @@ fn _run(cmd: &Command) -> anyhow::Result<()> { gen_completions::write_completions_home()?; - if settings.modify_path { - #[cfg(windows)] - { - use std::env::join_paths; + #[cfg(windows)] + { + use std::env::join_paths; + if settings.modify_path { windows_augment_path(|orig_path| { if orig_path.iter().any(|p| p == &settings.installation_path) { return None; @@ -174,21 +174,22 @@ fn _run(cmd: &Command) -> anyhow::Result<()> { ) })?; } - if cfg!(unix) { - let line = format!( - "\nexport PATH=\"{}:$PATH\"", - settings.installation_path.display() - ); - for path in &settings.rc_files { - ensure_line(path, &line) - .with_context(|| format!("failed to update profile file {path:?}"))?; - } - if let Some(dir) = settings.env_file.parent() { - fs::create_dir_all(dir).with_context(|| format!("failed to create {dir:?}"))?; - } - fs::write(&settings.env_file, line + "\n") - .with_context(|| format!("failed to write env file {:?}", settings.env_file))?; + } + + if settings.modify_path && cfg!(unix) { + let line = format!( + "\nexport PATH=\"{}:$PATH\"", + settings.installation_path.display() + ); + for path in &settings.rc_files { + ensure_line(path, &line) + .with_context(|| format!("failed to update profile file {path:?}"))?; + } + if let Some(dir) = settings.env_file.parent() { + fs::create_dir_all(dir).with_context(|| format!("failed to create {dir:?}"))?; } + fs::write(&settings.env_file, line + "\n") + .with_context(|| format!("failed to write env file {:?}", settings.env_file))?; } let base = home_dir()?.join(".edgedb"); diff --git a/src/cloud/client.rs b/src/cloud/client.rs index a589a01b..bf838698 100644 --- a/src/cloud/client.rs +++ b/src/cloud/client.rs @@ -233,7 +233,7 @@ impl CloudClient { "error decoding response body".to_string() }) } else { - let code = resp.status().clone(); + let code = resp.status(); let full = resp.text().await?; Err(anyhow::anyhow!(serde_json::from_str(&full) .map(|mut e: ErrorResponse| { diff --git a/src/commands/execute.rs b/src/commands/execute.rs index 441ade40..30643014 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -19,11 +19,8 @@ pub async fn common( use Common::*; // match commands that don't need connection - match cmd { - Branch(cmd) => { - return branch::run(&cmd.subcommand, options, conn).await; - } - _ => {} + if let Branch(cmd) = cmd { + return branch::run(&cmd.subcommand, options, conn).await; } // connect diff --git a/src/connect.rs b/src/connect.rs index a69e05c0..973836fe 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -481,7 +481,7 @@ impl Connection { .decode(&self.state.data[..]) .map_err(ProtocolEncodingError::with_source)?; - Ok((desc.id().clone(), value)) + Ok((*desc.id(), value)) } pub fn get_state(&self) -> &State { &self.state diff --git a/src/migrations/create.rs b/src/migrations/create.rs index 27deb2c7..b2f4a931 100644 --- a/src/migrations/create.rs +++ b/src/migrations/create.rs @@ -995,7 +995,7 @@ fn substitute_placeholders<'x>( .text .strip_prefix(r"\(") .and_then(|item| item.strip_suffix(')')) - .ok_or_else(|| bug::error(format!("bad substitution token")))?; + .ok_or_else(|| bug::error("bad substitution token".to_string()))?; let expr = placeholders .get(name) .ok_or_else(|| bug::error(format!("missing input for {name:?} placeholder")))?; diff --git a/src/portable/instance/credentials.rs b/src/portable/instance/credentials.rs index 3ca8c0a6..e15e2f68 100644 --- a/src/portable/instance/credentials.rs +++ b/src/portable/instance/credentials.rs @@ -24,13 +24,13 @@ pub fn show_credentials(options: &Options, c: &Command) -> anyhow::Result<()> { } match creds.tls_security { TlsSecurity::Strict => { - url.set_query(Some(&format!("tls_security=strict"))); + url.set_query(Some("tls_security=strict")); } TlsSecurity::Insecure => { - url.set_query(Some(&format!("tls_security=insecure"))); + url.set_query(Some("tls_security=insecure")); } TlsSecurity::NoHostVerification => { - url.set_query(Some(&format!("tls_security=no_host_verification"))); + url.set_query(Some("tls_security=no_host_verification")); } _ => {} } diff --git a/src/portable/project/init.rs b/src/portable/project/init.rs index f8b8d031..65746cdc 100644 --- a/src/portable/project/init.rs +++ b/src/portable/project/init.rs @@ -427,6 +427,7 @@ fn do_init( }) } +#[allow(clippy::too_many_arguments)] fn do_cloud_init( name: String, org: String, @@ -824,12 +825,6 @@ fn ask_name( } return Ok((default_name, false)); } - let q = question::String::new(concatcp!( - "Specify the name of the ", - BRANDING, - " instance to use with this project" - )) - .default(&default_name.to_string()); loop { let default_name_clone = default_name.clone(); let q = question::String::new(concatcp!( diff --git a/src/process.rs b/src/process.rs index f5cced4d..2b09cac5 100644 --- a/src/process.rs +++ b/src/process.rs @@ -633,14 +633,14 @@ impl Native { "Received TERM signal. Propagating to {}...", self.description ); - if self.try_stop_process().await.is_err() { - if unsafe { libc::kill(pid as i32, SIGTERM) } != 0 { - log::debug!( - "Error stopping {}: {}", - self.description, - io::Error::last_os_error() - ); - } + if self.try_stop_process().await.is_err() + && unsafe { libc::kill(pid as i32, SIGTERM) } != 0 + { + log::debug!( + "Error stopping {}: {}", + self.description, + io::Error::last_os_error() + ); } } }; diff --git a/src/prompt/variable.rs b/src/prompt/variable.rs index 50132853..d455f0fb 100644 --- a/src/prompt/variable.rs +++ b/src/prompt/variable.rs @@ -647,7 +647,7 @@ fn format_parsing_error(e: nom::Err) -> String { ParsingError::Mistake { kind: _kind, description, - } => format!("{description}"), + } => description.to_string(), ParsingError::External { description, error, diff --git a/src/repl.rs b/src/repl.rs index d5bcba8c..0236fce8 100644 --- a/src/repl.rs +++ b/src/repl.rs @@ -297,7 +297,7 @@ impl State { Some(gel_tokio::InstanceName::Local(name)) => { format!("{name}:{current_database}",) } - _ => format!("{current_database}"), + _ => current_database.to_string(), }; let lang = match self.input_language { @@ -374,7 +374,7 @@ impl State { let mut buf = BytesMut::with_capacity(self.edgeql_state.data.len()); codec.encode(&mut buf, &value)?; self.edgeql_state = EdgeqlState { - typedesc_id: desc.id().clone(), + typedesc_id: *desc.id(), data: buf.freeze(), }; conn.set_state(self.edgeql_state.clone()); @@ -403,7 +403,7 @@ impl State { .decode(&self.edgeql_state.data[..]) .map_err(ProtocolEncodingError::with_source)?; - Ok((desc.id().clone(), value)) + Ok((*desc.id(), value)) } } diff --git a/src/tty_password.rs b/src/tty_password.rs index 09e5e3ec..07eafec4 100644 --- a/src/tty_password.rs +++ b/src/tty_password.rs @@ -25,5 +25,5 @@ pub async fn read_async(prompt: impl AsRef) -> anyhow::Result { } pub async fn read_stdin_async() -> anyhow::Result { - tokio::task::spawn_blocking(|| read_stdin()).await? + tokio::task::spawn_blocking(read_stdin).await? } diff --git a/tests/docker_test_wrapper.rs b/tests/docker_test_wrapper.rs index 14476508..128aeeb6 100644 --- a/tests/docker_test_wrapper.rs +++ b/tests/docker_test_wrapper.rs @@ -90,8 +90,7 @@ extern "C" fn delete_docker_image() { } fn dockerfile() -> String { - format!( - r###" + r###" FROM ubuntu:jammy ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ @@ -105,7 +104,7 @@ fn dockerfile() -> String { ADD ./tests /tests RUN chown -R user1 /tests/proj "### - ) + .to_string() } #[test_case("portable_smoke")] diff --git a/tests/func/interactive.rs b/tests/func/interactive.rs index a6fa4e76..344808ac 100644 --- a/tests/func/interactive.rs +++ b/tests/func/interactive.rs @@ -114,10 +114,10 @@ fn force_database_error() { let mut cmd = SERVER.custom_interactive(|cmd| { cmd.arg("--database=error_test"); }); - cmd.exp_string(&format!("error_test>")).unwrap(); + cmd.exp_string("error_test>").unwrap(); cmd.send_line("configure current database reset force_database_error;") .unwrap(); - cmd.exp_string(&format!("error_test>")).unwrap(); + cmd.exp_string("error_test>").unwrap(); } #[test]