Skip to content

Commit

Permalink
fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nightmared committed Feb 12, 2021
1 parent 6abd46f commit 17bd89b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ fn instrument_handle_recent_async_trait(
}

// given an existing function, generate an instrumented version of that function
fn gen_function<'a>(
input: &'a ItemFn,
fn gen_function(
input: &ItemFn,
mut args: InstrumentArgs,
instrumented_function_name: String,
variables_rebindings: Vec<(Ident, Ident)>,
Expand Down Expand Up @@ -557,7 +557,7 @@ fn gen_block<'a>(
// eplace every use of a variable by its original name
if let Some(Fields(ref mut fields)) = args.fields {
let mut replacer = KnifeReplacer {
idents: param_names.clone(),
idents: param_names,
types: Vec::new(),
};

Expand Down Expand Up @@ -1159,6 +1159,9 @@ struct KnifeReplacer<'a> {
impl<'a> syn::visit_mut::VisitMut for KnifeReplacer<'a> {
fn visit_ident_mut(&mut self, id: &mut Ident) {
for (old_ident, new_ident) in &self.idents {
// we deliberately compare strings because we want to ignore the spans
// If we apply clippy's lint, the behavior changes
#[allow(clippy::cmp_owned)]
if id.to_string() == old_ident.to_string() {
*id = new_ident.clone();
}
Expand Down

0 comments on commit 17bd89b

Please sign in to comment.