Skip to content

Commit

Permalink
Clippy run over CLI (#1489)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac authored Feb 23, 2025
1 parent e0194da commit 1262298
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 184 deletions.
258 changes: 129 additions & 129 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion edgedb-cli-derive/src/attrib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl TryFrom<syn::Expr> for Case {
_ => {
return Err(syn::Error::new_spanned(
s,
format!("undefined case conversion"),
"undefined case conversion".to_string(),
));
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/analyze/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
37 changes: 19 additions & 18 deletions src/cli/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/cloud/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
7 changes: 2 additions & 5 deletions src/commands/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")))?;
Expand Down
Loading

0 comments on commit 1262298

Please sign in to comment.