mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Shared: Clippy fixes
Remove unnecessary borrows and lifetime specifiers.
This commit is contained in:
@@ -125,7 +125,7 @@ impl LogWriter {
|
||||
.create(true)
|
||||
.append(true)
|
||||
.write(true)
|
||||
.open(&path)
|
||||
.open(path)
|
||||
{
|
||||
Err(e) => {
|
||||
tracing::error!(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)?,
|
||||
|
||||
@@ -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)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user