Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused_qualifications warnings on Windows and exclude extract-generated-code-doc and generator from clippy's MSRV check #928

Merged
merged 6 commits into from
Jun 1, 2024
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
2 changes: 2 additions & 0 deletions extract-generated-code-doc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
unused_qualifications
)]
#![forbid(unsafe_code)]
// This crate is not shipped to users and does not follow our MSRV
#![allow(clippy::incompatible_msrv)]

use std::io::Error as IoError;
use std::path::Path;
Expand Down
11 changes: 8 additions & 3 deletions generator/src/generator/namespace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,13 +1115,16 @@ impl<'ns, 'c> NamespaceGenerator<'ns, 'c> {
continue;
}
let text = format!(
" * `{}` - {}",
"`{}` - {}",
field.name,
field.doc.as_deref().unwrap_or("").trim(),
);
let mut prefix_char = '*';
// Prevent rustdoc interpreting many leading spaces as code examples (?)
for line in text.trim().split('\n') {
let line = line.trim();
let line = format!("{} {}", prefix_char, line);
prefix_char = ' ';
if line.trim().is_empty() {
outln!(out, "///");
} else {
Expand All @@ -1139,12 +1142,14 @@ impl<'ns, 'c> NamespaceGenerator<'ns, 'c> {
outln!(out, "///");
for error in doc.errors.iter() {
let text = format!(
"* `{}` - {}",
"`{}` - {}",
error.type_,
error.doc.as_deref().unwrap_or("").trim(),
);
let mut prefix_char = '*';
for line in text.split('\n') {
outln!(out, "/// {}", line.trim_end());
outln!(out, "/// {} {}", prefix_char, line.trim_end());
prefix_char = ' ';
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
unused_qualifications
)]
#![forbid(unsafe_code)]
// This crate is not shipped to users and does not follow our MSRV
#![allow(clippy::incompatible_msrv)]

use std::path::{Path, PathBuf};
use std::process::ExitCode;
Expand Down
2 changes: 1 addition & 1 deletion x11rb-async/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
//!
//! Additionally, the following flags exist:
//! * `allow-unsafe-code`: Enable the same feature in x11rb and implement
//! [`blocking::BlockingConnection`] for [`x11rb::xcb_ffi::XCBConnection`]
//! [`blocking::BlockingConnection`] for [`x11rb::xcb_ffi::XCBConnection`]
//! * `extra-traits`: Implement extra traits for X11 types. This improves the output of the `Debug`
//! impl and adds `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` where possible.

Expand Down
36 changes: 18 additions & 18 deletions x11rb-async/src/protocol/composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ where
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
pub async fn redirect_window<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
Expand All @@ -99,8 +99,8 @@ where
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
pub async fn redirect_subwindows<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
Expand All @@ -122,9 +122,9 @@ where
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must be redirected by the
/// current client, or a Value error results.
/// current client, or a Value error results.
/// * `update` - The update type passed to RedirectWindows. If this does not match the
/// previously requested update type, a Value error results.
/// previously requested update type, a Value error results.
pub async fn unredirect_window<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
Expand All @@ -145,10 +145,10 @@ where
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must have previously been
/// selected for sub-redirection by the current client, or a Value error
/// results.
/// selected for sub-redirection by the current client, or a Value error
/// results.
/// * `update` - The update type passed to RedirectSubWindows. If this does not match
/// the previously requested update type, a Value error results.
/// the previously requested update type, a Value error results.
pub async fn unredirect_subwindows<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
Expand Down Expand Up @@ -240,8 +240,8 @@ pub trait ConnectionExt: RequestConnection {
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
fn composite_redirect_window(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
{
Box::pin(redirect_window(self, window, update))
Expand All @@ -257,8 +257,8 @@ pub trait ConnectionExt: RequestConnection {
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
fn composite_redirect_subwindows(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
{
Box::pin(redirect_subwindows(self, window, update))
Expand All @@ -271,9 +271,9 @@ pub trait ConnectionExt: RequestConnection {
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must be redirected by the
/// current client, or a Value error results.
/// current client, or a Value error results.
/// * `update` - The update type passed to RedirectWindows. If this does not match the
/// previously requested update type, a Value error results.
/// previously requested update type, a Value error results.
fn composite_unredirect_window(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
{
Box::pin(unredirect_window(self, window, update))
Expand All @@ -285,10 +285,10 @@ pub trait ConnectionExt: RequestConnection {
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must have previously been
/// selected for sub-redirection by the current client, or a Value error
/// results.
/// selected for sub-redirection by the current client, or a Value error
/// results.
/// * `update` - The update type passed to RedirectSubWindows. If this does not match
/// the previously requested update type, a Value error results.
/// the previously requested update type, a Value error results.
fn composite_unredirect_subwindows(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
{
Box::pin(unredirect_subwindows(self, window, update))
Expand Down
4 changes: 2 additions & 2 deletions x11rb-async/src/protocol/damage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ where
/// # Fields
///
/// * `damage` - The ID with which you will refer to the new Damage object, created by
/// `xcb_generate_id`.
/// `xcb_generate_id`.
/// * `drawable` - The ID of the drawable to be monitored.
/// * `level` - The level of detail to be provided in Damage events.
pub async fn create<Conn>(conn: &Conn, damage: Damage, drawable: xproto::Drawable, level: ReportLevel) -> Result<VoidCookie<'_, Conn>, ConnectionError>
Expand Down Expand Up @@ -223,7 +223,7 @@ pub trait ConnectionExt: RequestConnection {
/// # Fields
///
/// * `damage` - The ID with which you will refer to the new Damage object, created by
/// `xcb_generate_id`.
/// `xcb_generate_id`.
/// * `drawable` - The ID of the drawable to be monitored.
/// * `level` - The level of detail to be provided in Damage events.
fn damage_create(&self, damage: Damage, drawable: xproto::Drawable, level: ReportLevel) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
Expand Down
36 changes: 18 additions & 18 deletions x11rb-async/src/protocol/shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@ where
/// * `src_x` - The source X coordinate of the sub-image to copy.
/// * `src_y` - The source Y coordinate of the sub-image to copy.
/// * `src_width` - The width, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `src_height` - The height, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `dst_x` - The X coordinate on the destination drawable to copy to.
/// * `dst_y` - The Y coordinate on the destination drawable to copy to.
/// * `depth` - The depth to use.
/// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a
/// "BadMatch" error results. The foreground pixel in the GC determines the source
/// for the one bits in the image, and the background pixel determines the source
/// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of
/// the drawable, or a "BadMatch" error results.
/// "BadMatch" error results. The foreground pixel in the GC determines the source
/// for the one bits in the image, and the background pixel determines the source
/// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of
/// the drawable, or a "BadMatch" error results.
/// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit
/// completes.
/// completes.
/// * `offset` - The offset that the source image starts at.
pub async fn put_image<Conn>(conn: &Conn, drawable: xproto::Drawable, gc: xproto::Gcontext, total_width: u16, total_height: u16, src_x: u16, src_y: u16, src_width: u16, src_height: u16, dst_x: i16, dst_y: i16, depth: u8, format: u8, send_event: bool, shmseg: Seg, offset: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Expand Down Expand Up @@ -329,21 +329,21 @@ pub trait ConnectionExt: RequestConnection {
/// * `src_x` - The source X coordinate of the sub-image to copy.
/// * `src_y` - The source Y coordinate of the sub-image to copy.
/// * `src_width` - The width, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `src_height` - The height, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `dst_x` - The X coordinate on the destination drawable to copy to.
/// * `dst_y` - The Y coordinate on the destination drawable to copy to.
/// * `depth` - The depth to use.
/// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a
/// "BadMatch" error results. The foreground pixel in the GC determines the source
/// for the one bits in the image, and the background pixel determines the source
/// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of
/// the drawable, or a "BadMatch" error results.
/// "BadMatch" error results. The foreground pixel in the GC determines the source
/// for the one bits in the image, and the background pixel determines the source
/// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of
/// the drawable, or a "BadMatch" error results.
/// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit
/// completes.
/// completes.
/// * `offset` - The offset that the source image starts at.
fn shm_put_image(&self, drawable: xproto::Drawable, gc: xproto::Gcontext, total_width: u16, total_height: u16, src_x: u16, src_y: u16, src_width: u16, src_height: u16, dst_x: i16, dst_y: i16, depth: u8, format: u8, send_event: bool, shmseg: Seg, offset: u32) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
{
Expand Down
Loading
Loading