Skip to content

Commit 554d064

Browse files
committed
Fix breaking changes and warnings introduced in Rust 2021
Compiler messages: ------------------------------------------------------------------------------------------ error: prefix `property` is unknown --> gdnative-derive/src/native_script.rs:165:29 | 165 | builder.property#property_ty(#label) | ^^^^^^^^ unknown prefix | = note: prefixed identifiers and literals are reserved since Rust 2021 ------------------------------------------------------------------------------------------ warning: the item `TryFrom` is imported redundantly --> gdnative-core/src/core_types/variant_array.rs:489:13 | 489 | use std::convert::TryFrom; | ^^^^^^^^^^^^^^^^^^^^^ | ::: <toolchain>/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:133:13 | 133 | pub use core::prelude::rust_2021::*; | --------------------------- the item `TryFrom` is already defined here
1 parent 542ac7f commit 554d064

File tree

7 files changed

+1
-10
lines changed

7 files changed

+1
-10
lines changed

gdnative-core/src/core_types/dictionary.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ impl<'a, Own: Ownership> Iterator for Iter<'a, Own> {
446446

447447
#[inline]
448448
fn size_hint(&self) -> (usize, Option<usize>) {
449-
use std::convert::TryFrom;
450449
(0, usize::try_from(self.dic.len()).ok())
451450
}
452451
}
@@ -490,7 +489,6 @@ impl Iterator for IntoIter {
490489

491490
#[inline]
492491
fn size_hint(&self) -> (usize, Option<usize>) {
493-
use std::convert::TryFrom;
494492
(0, usize::try_from(self.dic.len()).ok())
495493
}
496494
}

gdnative-core/src/core_types/pool_array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::convert::TryFrom;
21
use std::fmt;
32
use std::iter::{Extend, FromIterator};
43

gdnative-core/src/core_types/string.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::private::get_api;
44
use crate::sys;
55

66
use std::cmp::Ordering;
7-
use std::convert::TryFrom;
87
use std::ffi::CStr;
98
use std::fmt;
109
use std::mem::forget;

gdnative-core/src/core_types/variant.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,8 +1584,6 @@ impl<T: ToVariant> ToVariant for Vec<T> {
15841584
impl<T: FromVariant> FromVariant for Vec<T> {
15851585
#[inline]
15861586
fn from_variant(variant: &Variant) -> Result<Self, FromVariantError> {
1587-
use std::convert::TryInto;
1588-
15891587
let arr = VariantArray::from_variant(variant)?;
15901588
let len: usize = arr
15911589
.len()

gdnative-core/src/core_types/variant_array.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ impl<'a, Own: Ownership> Iterator for Iter<'a, Own> {
433433

434434
#[inline]
435435
fn nth(&mut self, n: usize) -> Option<Self::Item> {
436-
use std::convert::TryFrom;
437436
let n = i32::try_from(n).ok()?;
438437

439438
if self.arr.len() > n {
@@ -486,7 +485,6 @@ impl Iterator for IntoIter {
486485

487486
#[inline]
488487
fn nth(&mut self, n: usize) -> Option<Self::Item> {
489-
use std::convert::TryFrom;
490488
let n = i32::try_from(n).ok()?;
491489

492490
if self.arr.len() > n {

gdnative-core/src/profiler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Interface to Godot's built-in profiler.
22
33
use std::borrow::Cow;
4-
use std::convert::TryFrom;
54
use std::ffi::{CStr, CString};
65
use std::time::{Duration, Instant};
76

gdnative-derive/src/native_script.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub(crate) fn derive_native_class(derive_input: &DeriveInput) -> Result<TokenStr
162162

163163
let label = config.path.unwrap_or_else(|| format!("{}", ident));
164164
Ok(quote!({
165-
builder.property#property_ty(#label)
165+
builder.property #property_ty(#label)
166166
#with_default
167167
#with_hint
168168
#with_usage

0 commit comments

Comments
 (0)