Shared: Clippy fixes

Remove unnecessary borrows and lifetime specifiers.
This commit is contained in:
Harry Maclean
2023-04-05 16:34:43 +08:00
parent 77ce6e7122
commit 6a8d417588
4 changed files with 6 additions and 6 deletions

View File

@@ -125,7 +125,7 @@ impl LogWriter {
.create(true)
.append(true)
.write(true)
.open(&path)
.open(path)
{
Err(e) => {
tracing::error!(

View File

@@ -123,7 +123,7 @@ pub fn extract(
source: &[u8],
ranges: &[Range],
) {
let path_str = file_paths::normalize_path(&path);
let path_str = file_paths::normalize_path(path);
let span = tracing::span!(
tracing::Level::TRACE,
"extract",
@@ -137,7 +137,7 @@ pub fn extract(
let mut parser = Parser::new();
parser.set_language(language).unwrap();
parser.set_included_ranges(ranges).unwrap();
let tree = parser.parse(&source, None).expect("Failed to parse file");
let tree = parser.parse(source, None).expect("Failed to parse file");
trap_writer.comment(format!("Auto-generated TRAP file for {}", path_str));
let file_label = populate_file(trap_writer, path);
let mut visitor = Visitor::new(
@@ -441,7 +441,7 @@ impl<'a> Visitor<'a> {
"Value for unknown field: {}::{} and type {}",
&[
diagnostics::MessageArg::Code(node.kind()),
diagnostics::MessageArg::Code(&child_node.field_name.unwrap_or("child")),
diagnostics::MessageArg::Code(child_node.field_name.unwrap_or("child")),
diagnostics::MessageArg::Code(&format!("{:?}", child_node.type_name)),
],
*node,

View File

@@ -119,7 +119,7 @@ impl<'a> fmt::Display for Union<'a> {
}
/// Generates the dbscheme by writing the given dbscheme `entries` to the `file`.
pub fn write<'a>(file: &mut dyn std::io::Write, entries: &'a [Entry]) -> std::io::Result<()> {
pub fn write(file: &mut dyn std::io::Write, entries: &[Entry]) -> std::io::Result<()> {
for entry in entries {
match entry {
Entry::Case(case) => write!(file, "{}\n\n", case)?,

View File

@@ -287,7 +287,7 @@ impl<'a> fmt::Display for FormalParameter<'a> {
}
/// Generates a QL library by writing the given `elements` to the `file`.
pub fn write<'a>(file: &mut dyn std::io::Write, elements: &'a [TopLevel]) -> std::io::Result<()> {
pub fn write(file: &mut dyn std::io::Write, elements: &[TopLevel]) -> std::io::Result<()> {
for element in elements {
write!(file, "{}\n\n", &element)?;
}