Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Rustfmt
on:
pull_request:

jobs:
formatting:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
2 changes: 1 addition & 1 deletion src/clipboard/mac.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::ClipBackend;
use super::CopyConfig;
use super::PasteConfig;
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};

use cocoa::appkit;
use cocoa::appkit::NSPasteboard;
Expand Down
2 changes: 1 addition & 1 deletion src/clipboard/mime_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{bail, Result};
use anyhow::{Result, bail};

const TEXT_TYPE_EXACT: &[&str] = &[
"text/plain;charset=utf-8",
Expand Down
2 changes: 1 addition & 1 deletion src/clipboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ mod wayland;
mod x;

use super::protocol::SourceData;
use anyhow::Result;
#[cfg(target_os = "linux")]
use anyhow::bail;
use anyhow::Result;
use std::io::Write;

pub trait ClipBackend {
Expand Down
10 changes: 5 additions & 5 deletions src/clipboard/x.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
use super::mime_type::decide_mime_type;
use super::ClipBackend;
use super::CopyConfig;
use super::PasteConfig;
use super::mime_type::decide_mime_type;
use crate::protocol::SourceData;
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use std::collections::hash_map::HashMap;
use std::io::Write;
use std::rc::Rc;
use x11rb::atom_manager;
use x11rb::connection::Connection;
use x11rb::connection::RequestConnection;
use x11rb::protocol::Event;
use x11rb::protocol::xproto::{
Atom, AtomEnum, ChangeWindowAttributesAux, ConnectionExt, CreateWindowAux, EventMask, PropMode,
Property, SelectionNotifyEvent, SelectionRequestEvent, Window, WindowClass,
SELECTION_NOTIFY_EVENT,
Property, SELECTION_NOTIFY_EVENT, SelectionNotifyEvent, SelectionRequestEvent, Window,
WindowClass,
};
use x11rb::protocol::Event;
use x11rb::rust_connection::RustConnection;
use x11rb::wrapper::ConnectionExt as WrapperConnectionExt;
use x11rb::{COPY_DEPTH_FROM_PARENT, CURRENT_TIME};
Expand Down
4 changes: 2 additions & 2 deletions src/protocol/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod recv;
mod source_data;

pub use recv::receive_data_bulk;
pub use recv::receive_data_oneshot;
#[allow(unused_imports)]
pub use recv::PROTOCAL_VER;
pub use recv::receive_data_bulk;
pub use recv::receive_data_oneshot;
pub use source_data::SourceData;
2 changes: 1 addition & 1 deletion src/protocol/recv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use std::io::Read;

pub static PROTOCAL_VER: u8 = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/source_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ impl SourceData for Vec<SourceDataItem> {
#[cfg(test)]
mod tests {
use super::*;
use crate::protocol::receive_data_bulk;
use crate::protocol::PROTOCAL_VER;
use crate::protocol::receive_data_bulk;

#[test]
fn test_content_by_mime_type() {
Expand Down
Loading