import TryFrom only for sk_msg programs

Avoid unused_imports warning for std::convert::TryFrom.
Conditionally import it only when it is needed -
in sk_msg programs.

remove unused `std::convert::TryFrom` import to avoid the warning in the generated projects:
```
warning: unused import: `TryFrom`
 --> myapp/src/main.rs:4:15
  |
4 |     convert::{TryFrom,TryInto},
  |               ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `myapp` (bin "myapp") generated 1 warning
```
pull/8/head
Dmitry Savintsev 3 years ago committed by Dmitry S
parent bc7cd9ad46
commit c7dfae4933

@ -14,6 +14,7 @@ use aya::programs::SockOps;
use aya::maps::{MapRefMut,SockHash}; use aya::maps::{MapRefMut,SockHash};
use aya::programs::SkMsg; use aya::programs::SkMsg;
use {{crate_name}}_common::SockKey; use {{crate_name}}_common::SockKey;
use std::convert::TryFrom;
{%- when "xdp" -%} {%- when "xdp" -%}
use aya::programs::{Xdp, XdpFlags}; use aya::programs::{Xdp, XdpFlags};
{%- when "classifier" -%} {%- when "classifier" -%}
@ -28,7 +29,7 @@ use aya::{programs::Lsm, Btf};
use aya::{programs::BtfTracePoint, Btf}; use aya::{programs::BtfTracePoint, Btf};
{%- endcase %} {%- endcase %}
use std::{ use std::{
convert::{TryFrom,TryInto}, convert::TryInto,
sync::Arc, sync::Arc,
sync::atomic::{AtomicBool, Ordering}, sync::atomic::{AtomicBool, Ordering},
thread, thread,

Loading…
Cancel
Save