Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply clippy fixes #11770

Merged
merged 1 commit into from Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 21 additions & 21 deletions crates/nu-command/src/database/values/sqlite.rs
Expand Up @@ -521,6 +521,27 @@ pub fn convert_sqlite_value_to_nu_value(value: ValueRef, span: Span) -> Value {
}
}

pub fn open_connection_in_memory_custom() -> Result<Connection, ShellError> {
let flags = OpenFlags::default();
Connection::open_with_flags(MEMORY_DB, flags).map_err(|e| ShellError::GenericError {
error: "Failed to open SQLite custom connection in memory".into(),
msg: e.to_string(),
span: Some(Span::test_data()),
help: None,
inner: vec![],
})
}

pub fn open_connection_in_memory() -> Result<Connection, ShellError> {
Connection::open_in_memory().map_err(|e| ShellError::GenericError {
error: "Failed to open SQLite standard connection in memory".into(),
msg: e.to_string(),
span: Some(Span::test_data()),
help: None,
inner: vec![],
})
}

#[cfg(test)]
mod test {
use super::*;
Expand Down Expand Up @@ -598,24 +619,3 @@ mod test {
assert_eq!(converted_db, expected);
}
}

pub fn open_connection_in_memory_custom() -> Result<Connection, ShellError> {
let flags = OpenFlags::default();
Connection::open_with_flags(MEMORY_DB, flags).map_err(|e| ShellError::GenericError {
error: "Failed to open SQLite custom connection in memory".into(),
msg: e.to_string(),
span: Some(Span::test_data()),
help: None,
inner: vec![],
})
}

pub fn open_connection_in_memory() -> Result<Connection, ShellError> {
Connection::open_in_memory().map_err(|e| ShellError::GenericError {
error: "Failed to open SQLite standard connection in memory".into(),
msg: e.to_string(),
span: Some(Span::test_data()),
help: None,
inner: vec![],
})
}
2 changes: 1 addition & 1 deletion crates/nu-command/src/filesystem/ucp.rs
Expand Up @@ -173,7 +173,7 @@ impl Command for UCp {
target.item.to_string(),
));
let cwd = current_dir(engine_state, stack)?;
let target_path = nu_path::expand_path_with(&target_path, &cwd);
let target_path = nu_path::expand_path_with(target_path, &cwd);
if target.item.as_ref().ends_with(PATH_SEPARATOR) && !target_path.is_dir() {
return Err(ShellError::GenericError {
error: "is not a directory".into(),
Expand Down
24 changes: 12 additions & 12 deletions crates/nu-command/src/filters/find.rs
Expand Up @@ -587,18 +587,6 @@ fn record_matches_term(
})
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_examples() {
use crate::test_examples;

test_examples(Find)
}
}

fn split_string_if_multiline(input: PipelineData, head_span: Span) -> PipelineData {
let span = input.span().unwrap_or(head_span);
match input {
Expand All @@ -618,3 +606,15 @@ fn split_string_if_multiline(input: PipelineData, head_span: Span) -> PipelineDa
_ => input,
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_examples() {
use crate::test_examples;

test_examples(Find)
}
}
24 changes: 12 additions & 12 deletions crates/nu-command/src/generators/seq.rs
Expand Up @@ -115,18 +115,6 @@ fn seq(
run_seq(rest_nums, span, contains_decimals, engine_state)
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_examples() {
use crate::test_examples;

test_examples(Seq {})
}
}

pub fn run_seq(
free: Vec<f64>,
span: Span,
Expand Down Expand Up @@ -210,3 +198,15 @@ impl Iterator for IntSeq {
ret
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_examples() {
use crate::test_examples;

test_examples(Seq {})
}
}