diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4be92c..ea52ca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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] @@ -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 @@ -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' @@ -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 }} diff --git a/crates/weechat-sys/build.rs b/crates/weechat-sys/build.rs index 2fec36a..e032f26 100644 --- a/crates/weechat-sys/build.rs +++ b/crates/weechat-sys/build.rs @@ -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!"); diff --git a/crates/weechat/src/buffer/lines.rs b/crates/weechat/src/buffer/lines.rs index 66ff459..da7ffd6 100644 --- a/crates/weechat/src/buffer/lines.rs +++ b/crates/weechat/src/buffer/lines.rs @@ -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); } diff --git a/crates/weechat/src/buffer/mod.rs b/crates/weechat/src/buffer/mod.rs index 0f096c6..c206efa 100644 --- a/crates/weechat/src/buffer/mod.rs +++ b/crates/weechat/src/buffer/mod.rs @@ -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> { - self.get_string(&format!("localvar_{}", property)) + self.get_string(&format!("localvar_{property}")) } /// Set the value of a buffer localvar @@ -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. diff --git a/crates/weechat/src/hooks/timer.rs b/crates/weechat/src/hooks/timer.rs index 3e8b2e3..4eb5982 100644 --- a/crates/weechat/src/hooks/timer.rs +++ b/crates/weechat/src/hooks/timer.rs @@ -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), diff --git a/crates/weechat/src/weechat.rs b/crates/weechat/src/weechat.rs index 07b0258..651e7e9 100644 --- a/crates/weechat/src/weechat.rs +++ b/crates/weechat/src/weechat.rs @@ -180,7 +180,7 @@ impl Weechat { } #[cfg(not(feature = "async"))] { - println!("thread '{}' panicked: {}", thread_name, info); + println!("thread '{thread_name}' panicked: {info}"); } } } @@ -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