Skip to content

Commit

Permalink
Fix nightly clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Apr 1, 2024
1 parent 0afb2a6 commit a57f2c3
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 50 deletions.
2 changes: 1 addition & 1 deletion gdk4-x11/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, IntoGStr};
use glib::translate::*;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::Atom as XAtom;
Expand Down
2 changes: 1 addition & 1 deletion gdk4-x11/src/x11_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{boxed::Box as Box_, mem::transmute};
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use glib::signal::{connect_raw, SignalHandlerId};
use glib::{translate::*, IntoGStr};
use glib::translate::*;
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;
Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/content_formats_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, IntoGStr};
use glib::translate::*;

use crate::{ContentFormats, ContentFormatsBuilder};

Expand Down
22 changes: 10 additions & 12 deletions gdk4/src/display.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::{mem, ptr};

use glib::{translate::*, IntoGStr};
use glib::translate::*;

use crate::{prelude::*, Display, Key, KeymapKey, ModifierType};

Expand Down Expand Up @@ -69,10 +67,10 @@ pub trait DisplayExtManual: sealed::Sealed + IsA<Display> + 'static {
group: i32,
) -> Option<(Key, i32, i32, ModifierType)> {
unsafe {
let mut keyval = mem::MaybeUninit::uninit();
let mut effective_group = mem::MaybeUninit::uninit();
let mut level = mem::MaybeUninit::uninit();
let mut consumed = mem::MaybeUninit::uninit();
let mut keyval = std::mem::MaybeUninit::uninit();
let mut effective_group = std::mem::MaybeUninit::uninit();
let mut level = std::mem::MaybeUninit::uninit();
let mut consumed = std::mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gdk_display_translate_key(
self.as_ref().to_glib_none().0,
keycode,
Expand Down Expand Up @@ -122,8 +120,8 @@ pub trait DisplayExtManual: sealed::Sealed + IsA<Display> + 'static {
#[doc(alias = "gdk_display_map_keyval")]
fn map_keyval(&self, keyval: Key) -> Option<Vec<KeymapKey>> {
unsafe {
let mut keys = ptr::null_mut();
let mut n_keys = mem::MaybeUninit::uninit();
let mut keys = std::ptr::null_mut();
let mut n_keys = std::mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gdk_display_map_keyval(
self.as_ref().to_glib_none().0,
keyval.into_glib(),
Expand All @@ -144,9 +142,9 @@ pub trait DisplayExtManual: sealed::Sealed + IsA<Display> + 'static {
#[doc(alias = "gdk_display_map_keycode")]
fn map_keycode(&self, keycode: u32) -> Option<Vec<(KeymapKey, Key)>> {
unsafe {
let mut keys = ptr::null_mut();
let mut keyvals = ptr::null_mut();
let mut n_entries = mem::MaybeUninit::uninit();
let mut keys = std::ptr::null_mut();
let mut keyvals = std::ptr::null_mut();
let mut n_entries = std::mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gdk_display_map_keycode(
self.as_ref().to_glib_none().0,
keycode,
Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::{fmt, str::FromStr};

use glib::{translate::*, IntoGStr};
use glib::translate::*;

use crate::RGBA;

Expand Down
2 changes: 1 addition & 1 deletion gsk4/src/transform.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, IntoGStr};
use glib::translate::*;

use crate::Transform;

Expand Down
12 changes: 3 additions & 9 deletions gtk4-macros/src/attribute_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ fn parse_attribute(meta: &NestedMeta) -> Result<(String, String)> {
}

pub enum FieldAttributeArg {
#[allow(dead_code)]
// The span is needed for xml_validation feature
Id(String, Span),
Internal(bool),
}
Expand All @@ -148,8 +150,6 @@ pub enum FieldAttributeType {
pub struct FieldAttribute {
pub ty: FieldAttributeType,
pub args: Vec<FieldAttributeArg>,
pub path_span: Span,
pub span: Span,
}

pub struct AttributedField {
Expand Down Expand Up @@ -292,7 +292,6 @@ fn parse_field(field: &Field) -> Result<Option<AttributedField>, Error> {

for field_attr in field_attrs {
let span = field_attr.span();
let path_span = field_attr.path.span();
let ty = if field_attr.path.is_ident("template_child") {
Some(FieldAttributeType::TemplateChild)
} else {
Expand All @@ -303,12 +302,7 @@ fn parse_field(field: &Field) -> Result<Option<AttributedField>, Error> {
let args = parse_field_attr_args(&ty, field_attr)?;

if attr.is_none() {
attr = Some(FieldAttribute {
ty,
args,
path_span,
span,
})
attr = Some(FieldAttribute { ty, args })
} else {
return Err(Error::new(
span,
Expand Down
1 change: 0 additions & 1 deletion gtk4-macros/src/composite_template_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#[cfg(feature = "xml_validation")]
use std::collections::HashMap;
use std::string::ToString;

use proc_macro2::TokenStream;
use proc_macro_error::{emit_call_site_error, emit_error};
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::{cell::RefCell, rc::Rc};

use gio::ApplicationFlags;
use glib::{signal::SignalHandlerId, translate::*, IntoOptionalGStr};
use glib::{signal::SignalHandlerId, translate::*};

use crate::{prelude::*, rt, Application};

Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::path::Path;

use glib::{translate::*, IntoGStr, Object};
use glib::{translate::*, Object};

use crate::{prelude::*, Builder};

Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
rc::Rc,
};

use glib::{translate::*, IntoOptionalGStr};
use glib::translate::*;

use crate::{prelude::*, Dialog, DialogFlags, ResponseType, Widget, Window};

Expand Down
2 changes: 0 additions & 2 deletions gtk4/src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::convert::TryFrom;

use glib::translate::*;

use crate::{prelude::*, Entry};
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/entry_buffer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, GString, IntoGStr, IntoOptionalGStr};
use glib::{translate::*, GString};
use libc::{c_int, c_uint};

use crate::{prelude::*, EntryBuffer};
Expand Down
3 changes: 1 addition & 2 deletions gtk4/src/file_chooser.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, IntoGStr};

use crate::{prelude::*, FileChooser};
use glib::translate::*;

mod sealed {
pub trait Sealed {}
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/file_chooser_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::ptr;

use glib::{translate::*, IntoOptionalGStr};
use glib::translate::*;
use libc::c_char;

use crate::{prelude::*, FileChooserAction, FileChooserDialog, ResponseType, Widget, Window};
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/icon_theme.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, IntoGStr, Slice};
use glib::{translate::*, Slice};

use crate::IconTheme;

Expand Down
7 changes: 3 additions & 4 deletions gtk4/src/message_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use std::ptr;

use glib::{translate::*, IntoGStr, IntoOptionalGStr};
use libc::c_char;
use glib::translate::*;

use crate::{prelude::*, ButtonsType, DialogFlags, MessageDialog, MessageType, Widget, Window};

Expand All @@ -26,9 +25,9 @@ impl MessageDialog {
flags.into_glib(),
type_.into_glib(),
buttons.into_glib(),
b"%s\0".as_ptr() as *const c_char,
b"%s\0".as_ptr() as *const libc::c_char,
message.as_ptr(),
ptr::null::<c_char>(),
ptr::null::<libc::c_char>(),
))
.unsafe_cast()
})
Expand Down
6 changes: 1 addition & 5 deletions gtk4/src/response_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
use std::fmt;

use crate::prelude::*;
use glib::{
translate::*,
value::{FromValue, ValueType},
Type, Value,
};
use glib::{translate::*, value::FromValue, Type, Value};

#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[doc(alias = "GtkResponseType")]
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::borrow::Borrow;

use glib::{translate::*, IntoGStr};
use glib::translate::*;

use crate::{prelude::*, Snapshot};

Expand Down
2 changes: 0 additions & 2 deletions gtk4/src/string_list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::iter::FromIterator;

use crate::{prelude::*, StringList};

impl FromIterator<&'static str> for StringList {
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::mem::transmute;
use glib::{
signal::{connect_raw, SignalHandlerId},
translate::*,
GString, IntoGStr,
GString,
};

use crate::{prelude::*, DeleteType, MovementStep, Text, Widget};
Expand Down

0 comments on commit a57f2c3

Please sign in to comment.