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
30 changes: 24 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ jobs:
strategy:
matrix:
target: [
{ "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" },
{ "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU (64-bit)" },
{ "os": "ubuntu-latest", "toolchain": "i686-unknown-linux-gnu", "name": "Linux GNU (32-bit)" },
# TODO: Add some more OS variants here.
]
channel: [stable, beta, nightly]
Expand All @@ -97,22 +98,32 @@ jobs:
sudo apt-get update
sudo apt-get install weechat-dev

- if: ${{ matrix.target.toolchain == 'i686-unknown-linux-gnu' }}
run: sudo apt-get install libc6-dev-i386

- run: rustup target add ${{ matrix.target.toolchain }}

- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ format('{0}-{1}', matrix.channel, matrix.target.toolchain) }}
toolchain: ${{ matrix.channel }}
targets: ${{ matrix.target.toolchain }}

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --all-features
run: cargo test --all-features --target ${{ matrix.target.toolchain }}

test-api:
name: Test Weechat API
needs: [test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
version:
- v3.8
- v4.0.0
Expand All @@ -121,6 +132,7 @@ jobs:
- v4.3.0
- v4.4.0
- v4.5.0
- v4.6.0
env:
WEECHAT_BUNDLED: 'no'
WEECHAT_PLUGIN_FILE: '${{ github.workspace }}/weechat-src/src/plugins/weechat-plugin.h'
Expand All @@ -140,18 +152,24 @@ jobs:
- run: sudo apt -y update
- run: sudo apt -y install libclang-dev

- if: ${{ matrix.toolchain == 'i686-unknown-linux-gnu' }}
run: sudo apt-get install libc6-dev-i386

- run: rustup target add ${{ matrix.toolchain }}

- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
targets: ${{ matrix.toolchain }}
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --all-features
run: cargo test --all-features --target ${{ matrix.toolchain }}

- name: Build
run: cargo build --all-features
run: cargo build --all-features --target ${{ matrix.toolchain }}

- name: Lint
run: cargo clippy --all-features
run: cargo clippy --all-features --target ${{ matrix.toolchain }}
4 changes: 2 additions & 2 deletions crates/weechat-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ fn main() {
}
};

println!("cargo:rerun-if-env-changed={}", WEECHAT_BUNDLED_ENV);
println!("cargo:rerun-if-env-changed={}", WEECHAT_PLUGIN_FILE_ENV);
println!("cargo:rerun-if-env-changed={WEECHAT_BUNDLED_ENV}");
println!("cargo:rerun-if-env-changed={WEECHAT_PLUGIN_FILE_ENV}");

let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings.write_to_file(out_path.join("bindings.rs")).expect("Couldn't write bindings!");
Expand Down
2 changes: 1 addition & 1 deletion crates/weechat/src/buffer/lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'a> BufferLine<'a> {
let tag = self.weechat.hdata_string(
self.hdata(),
self.line_data_pointer,
&format!("{}|tags_array", i),
&format!("{i}|tags_array"),
);
tags.push(tag);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/weechat/src/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ impl Buffer<'_> {
/// * `property` - The name of the property for which the value should be
/// fetched.
pub fn get_localvar(&self, property: &str) -> Option<Cow<str>> {
self.get_string(&format!("localvar_{}", property))
self.get_string(&format!("localvar_{property}"))
}

/// Set the value of a buffer localvar
Expand All @@ -1087,7 +1087,7 @@ impl Buffer<'_> {
///
/// * `value` - The value that the property should get.
pub fn set_localvar(&self, property: &str, value: &str) {
self.set(&format!("localvar_set_{}", property), value)
self.set(&format!("localvar_set_{property}"), value)
}

/// Get the full name of the buffer.
Expand Down
2 changes: 1 addition & 1 deletion crates/weechat/src/hooks/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl TimerHook {
let hook_ptr = unsafe {
hook_timer(
weechat.ptr,
interval.as_millis() as i64,
interval.as_millis() as _,
align_second,
max_calls,
Some(c_hook_cb),
Expand Down
4 changes: 2 additions & 2 deletions crates/weechat/src/weechat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl Weechat {
}
#[cfg(not(feature = "async"))]
{
println!("thread '{}' panicked: {}", thread_name, info);
println!("thread '{thread_name}' panicked: {info}");
}
}
}
Expand Down Expand Up @@ -358,7 +358,7 @@ impl Weechat {
///
/// Panics if the method is not called from the main Weechat thread.
pub fn color_pair(foreground_color: &str, background_color: &str) -> String {
Weechat::color(&format!("{},{}", foreground_color, background_color)).to_string()
Weechat::color(&format!("{foreground_color},{background_color}")).to_string()
}

/// Retrieve a prefix value
Expand Down