diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 90a2fcbd..ecafd5f3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,8 +17,9 @@ env: # Linters inspired from here: https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md jobs: - fmt: - name: Rustfmt + + macOS: + name: MacOS (fmt, build, clippy, test) runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -27,15 +28,26 @@ jobs: profile: minimal toolchain: stable override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 + - name: fmt + run: rustup component add rustfmt + uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check + - name: build + run: cargo build --verbose + - name: clippy + run: rustup component add clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + - name: test + run: cargo test --verbose - clippy: - name: Clippy - runs-on: macos-latest + Linux: + name: Linux (fmt, build, clippy, test) + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 @@ -43,40 +55,37 @@ jobs: profile: minimal toolchain: stable override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings - Mac: - name: Mac Tests - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - Linux: - name: Linux Tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - name: Install libpcap run: sudo apt-get install libpcap-dev - name: Install dependency for alsa-sys run: sudo apt-get install libasound2-dev - - name: Build + - name: fmt + run: rustup component add rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + - name: build run: cargo build --verbose - - name: Run tests + - name: clippy + run: rustup component add clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + - name: test run: cargo test --verbose Windows: - name: Windows Tests + name: Windows (fmt, build, clippy, test) runs-on: windows-latest steps: - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true - name: Install npcap sdk run: | Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "C:/npcap-sdk.zip" @@ -89,9 +98,23 @@ jobs: run: | Invoke-WebRequest -Uri ${{secrets.NPCAP_OEM_URL}} -OutFile C:/npcap-oem.exe C:/npcap-oem.exe /S - - name: Build + - name: fmt + if: github.event_name != 'pull_request' + run: rustup component add rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + - name: build if: github.event_name != 'pull_request' run: cargo build --verbose - - name: Run tests + - name: clippy + if: github.event_name != 'pull_request' + run: rustup component add clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + - name: test if: github.event_name != 'pull_request' run: cargo test --verbose diff --git a/src/gui/pages/notifications_page.rs b/src/gui/pages/notifications_page.rs index 3b34a57e..4a4ef09a 100644 --- a/src/gui/pages/notifications_page.rs +++ b/src/gui/pages/notifications_page.rs @@ -318,19 +318,28 @@ fn favorite_notification_log( let domain = logged_notification.host.domain; let country = logged_notification.host.country; let asn = logged_notification.host.asn; - let details_str = format!("{domain} - {}", asn.name); - let mut row_flag_details = Row::new().align_items(Alignment::Center).spacing(5); - if !country.is_empty() { - row_flag_details = row_flag_details.push(get_flag_tooltip( + + let row_flag_details = Row::new() + .align_items(Alignment::Center) + .spacing(5) + .push(get_flag_tooltip( &country, FLAGS_WIDTH_BIG, logged_notification.data_info_host.is_local, logged_notification.data_info_host.traffic_type, language, style, - )); - } - row_flag_details = row_flag_details.push(Text::new(details_str).font(font)); + )) + .push(Text::new(domain).font(font)) + .push( + Text::new(if asn.name.is_empty() { + String::new() + } else { + format!(" - {}", asn.name) + }) + .font(font), + ); + let content = Row::new() .spacing(30) .align_items(Alignment::Center) diff --git a/src/gui/pages/overview_page.rs b/src/gui/pages/overview_page.rs index 0a4ade1e..6f41d719 100644 --- a/src/gui/pages/overview_page.rs +++ b/src/gui/pages/overview_page.rs @@ -588,7 +588,9 @@ fn lazy_col_info( #[cfg(not(target_os = "windows"))] let adapter_info = &sniffer.device.name; #[cfg(target_os = "windows")] - let mut adapter_info = &sniffer.device.desc.unwrap_or(sniffer.device.name.clone()); + let adapter_name = &sniffer.device.name; + #[cfg(target_os = "windows")] + let adapter_info = sniffer.device.desc.as_ref().unwrap_or(adapter_name); let col_device_filters = Column::new() .width(Length::FillPortion(1))