浏览代码

Clarify `Arc` usage

Absent this it's easy to miss that there's an `Arc` being cloned here.
Tamir Duberstein 5 月之前
父节点
当前提交
afd777b705
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      aya/src/bpf.rs

+ 1 - 1
aya/src/bpf.rs

@@ -535,7 +535,7 @@ impl<'a> EbpfLoader<'a> {
                 let section = prog_obj.section.clone();
                 let obj = (prog_obj, function_obj);
 
-                let btf_fd = btf_fd.clone();
+                let btf_fd = btf_fd.as_ref().map(Arc::clone);
                 let program = if extensions.contains(name.as_str()) {
                     Program::Extension(Extension {
                         data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level),