Skip to content

Commit b2fcbe3

Browse files
committed
Fix various new beta clippy warnings
1 parent db5f305 commit b2fcbe3

File tree

12 files changed

+14
-37
lines changed

12 files changed

+14
-37
lines changed

cairo/src/rectangle_int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl RectangleInt {
2828
self.0.x = x;
2929
}
3030
pub fn y(&self) -> i32 {
31-
self.0.x
31+
self.0.y
3232
}
3333
pub fn set_y(&mut self, y: i32) {
3434
self.0.y = y;

examples/gio_cancellable_future/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ fn main() {
3838
thread::spawn(move || {
3939
thread::sleep(TIMEOUT);
4040

41-
println!(
42-
"Timeout ({:?}) elapsed! Cancelling pending task...",
43-
TIMEOUT
44-
);
41+
println!("Timeout ({TIMEOUT:?}) elapsed! Cancelling pending task...",);
4542

4643
cancellable.cancel();
4744
});

examples/gio_task/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ fn run_in_thread(send: oneshot::Sender<()>) {
106106
let cancellable = gio::Cancellable::new();
107107

108108
let closure = move |value: i64, source_object: &FileSize| {
109-
println!(
110-
"Safe callback (threaded version) - Returned value from task: {}",
111-
value
112-
);
109+
println!("Safe callback (threaded version) - Returned value from task: {value}",);
113110
println!(
114111
"Safe callback (threaded version) - FileSize::size: {}",
115112
source_object.retrieved_size().unwrap()

gdk-pixbuf/src/pixbuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl Pixbuf {
513513
Box::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
514514
let options = options
515515
.iter()
516-
.map(|&(ref k, ref v)| (k.as_str(), v.as_str()))
516+
.map(|(k, v)| (k.as_str(), v.as_str()))
517517
.collect::<Vec<(&str, &str)>>();
518518

519519
obj.save_to_streamv_async(

gio/src/input_stream.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,7 @@ impl<T: IsA<InputStream>> InputStreamAsyncBufRead<T> {
523523
{
524524
let available = j - i;
525525
if amt > available {
526-
panic!(
527-
"Cannot consume {} bytes as only {} are available",
528-
amt, available
529-
)
526+
panic!("Cannot consume {amt} bytes as only {available} are available",)
530527
}
531528
let remaining = available - amt;
532529
if remaining == 0 {

gio/src/output_stream.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,7 @@ impl<T: IsA<OutputStream>> io::Write for OutputStreamWrite<T> {
677677
.iter()
678678
.map(|v| OutputVector::new(v))
679679
.collect::<smallvec::SmallVec<[_; 2]>>();
680-
let result = self
681-
.0
682-
.as_ref()
683-
.writev(&vectors, crate::Cancellable::NONE)
684-
.map(|size| size as usize);
680+
let result = self.0.as_ref().writev(&vectors, crate::Cancellable::NONE);
685681
to_std_io_result(result)
686682
}
687683

gio/src/pollable_output_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<T: IsA<PollableOutputStream>> AsyncWrite for OutputStreamAsyncWrite<T> {
250250
.writev_nonblocking(&vectors, crate::Cancellable::NONE);
251251

252252
match gio_result {
253-
Ok((PollableReturn::Ok, size)) => Poll::Ready(Ok(size as usize)),
253+
Ok((PollableReturn::Ok, size)) => Poll::Ready(Ok(size)),
254254
Ok((PollableReturn::WouldBlock, _)) => {
255255
let mut waker = Some(cx.waker().clone());
256256
let source = stream.0.as_ref().create_source(

gio/src/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ impl<O: IsA<Socket>> SocketExtManual for O {
651651
&mut error,
652652
);
653653
if error.is_null() {
654-
Ok((from_glib(ret), bytes_written as usize))
654+
Ok((from_glib(ret), bytes_written))
655655
} else {
656656
Err(from_glib_full(error))
657657
}

glib/src/object.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,10 +2744,7 @@ impl<T: ObjectType> ObjectExt for T {
27442744

27452745
assert!(
27462746
type_.is_a(signal_query_type),
2747-
"Signal '{}' of type '{}' but got type '{}'",
2748-
signal_name,
2749-
type_,
2750-
signal_query_type
2747+
"Signal '{signal_name}' of type '{type_}' but got type '{signal_query_type}'",
27512748
);
27522749

27532750
let handler = gobject_ffi::g_signal_connect_closure_by_id(
@@ -2793,10 +2790,7 @@ impl<T: ObjectType> ObjectExt for T {
27932790
let signal_query_type = signal_query.type_();
27942791
assert!(
27952792
type_.is_a(signal_query_type),
2796-
"Signal '{}' of type '{}' but got type '{}'",
2797-
signal_name,
2798-
type_,
2799-
signal_query_type
2793+
"Signal '{signal_name}' of type '{type_}' but got type '{signal_query_type}'",
28002794
);
28012795

28022796
unsafe {

glib/src/param_spec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,7 @@ macro_rules! define_builder_numeric {
742742
fn assert_param_name(name: &str) {
743743
assert!(
744744
is_canonical_pspec_name(name),
745-
"{} is not a valid canonical parameter name",
746-
name
745+
"{name} is not a valid canonical parameter name",
747746
);
748747
}
749748
define_param_spec_numeric!(

0 commit comments

Comments
 (0)