Skip to content

Commit 3eba2b0

Browse files
authored
Update for clippy 1.83 (#441)
* Update for clippy 1.83 Signed-off-by: Michael X. Grey <[email protected]> * Update clippy for cfg(test) as well Signed-off-by: Michael X. Grey <[email protected]> * Exclude dependencies from clippy test Signed-off-by: Michael X. Grey <[email protected]> * Fix clippy for rosidl_runtime_rs Signed-off-by: Michael X. Grey <[email protected]> --------- Signed-off-by: Michael X. Grey <[email protected]>
1 parent a604ad7 commit 3eba2b0

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

.github/workflows/rust-minimal.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ jobs:
9393
echo "Running clippy in $path"
9494
# Run clippy for all features except generate_docs (needed for docs.rs)
9595
if [ "$(basename $path)" = "rclrs" ]; then
96-
cargo clippy --all-targets -F default,dyn_msg -- -D warnings
96+
cargo clippy --no-deps --all-targets -F default,dyn_msg -- -D warnings
9797
else
98-
cargo clippy --all-targets --all-features -- -D warnings
98+
cargo clippy --no-deps --all-targets --all-features -- -D warnings
9999
fi
100100
cd -
101101
done

.github/workflows/rust-stable.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ jobs:
9393
echo "Running clippy in $path"
9494
# Run clippy for all features except generate_docs (needed for docs.rs)
9595
if [ "$(basename $path)" = "rclrs" ]; then
96-
cargo clippy --all-targets -F default,dyn_msg -- -D warnings
96+
cargo clippy --no-deps --all-targets -F default,dyn_msg -- -D warnings
9797
else
98-
cargo clippy --all-targets --all-features -- -D warnings
98+
cargo clippy --no-deps --all-targets --all-features -- -D warnings
9999
fi
100100
cd -
101101
done

rclrs/src/logging/logging_configuration.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub(crate) mod log_handler {
103103
pub(crate) message: Cow<'a, str>,
104104
}
105105

106-
impl<'a> LogEntry<'a> {
106+
impl LogEntry<'_> {
107107
/// Change the entry from something borrowed into something owned
108108
pub(crate) fn into_owned(self) -> LogEntry<'static> {
109109
LogEntry {
@@ -124,7 +124,7 @@ pub(crate) mod log_handler {
124124
pub line_number: usize,
125125
}
126126

127-
impl<'a> LogLocation<'a> {
127+
impl LogLocation<'_> {
128128
pub(crate) fn into_owned(self) -> LogLocation<'static> {
129129
LogLocation {
130130
function_name: Cow::Owned(self.function_name.into_owned()),

rclrs/src/parameter.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a, T: ParameterVariant> ParameterBuilder<'a, T> {
195195
}
196196
}
197197

198-
impl<'a, T> ParameterBuilder<'a, Arc<[T]>>
198+
impl<T> ParameterBuilder<'_, Arc<[T]>>
199199
where
200200
Arc<[T]>: ParameterVariant,
201201
{
@@ -206,7 +206,7 @@ where
206206
}
207207
}
208208

209-
impl<'a> ParameterBuilder<'a, Arc<[Arc<str>]>> {
209+
impl ParameterBuilder<'_, Arc<[Arc<str>]>> {
210210
/// Sets the default for the parameter from a string-like array.
211211
pub fn default_string_array<U>(mut self, default_value: U) -> Self
212212
where
@@ -679,7 +679,7 @@ impl std::fmt::Display for DeclarationError {
679679

680680
impl std::error::Error for DeclarationError {}
681681

682-
impl<'a> Parameters<'a> {
682+
impl Parameters<'_> {
683683
/// Tries to read a parameter of the requested type.
684684
///
685685
/// Returns `Some(T)` if a parameter of the requested type exists, `None` otherwise.

rclrs/src/publisher/loaned_message.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ where
2222
pub(super) publisher: &'a Publisher<T>,
2323
}
2424

25-
impl<'a, T> Deref for LoanedMessage<'a, T>
25+
impl<T> Deref for LoanedMessage<'_, T>
2626
where
2727
T: RmwMessage,
2828
{
@@ -33,7 +33,7 @@ where
3333
}
3434
}
3535

36-
impl<'a, T> DerefMut for LoanedMessage<'a, T>
36+
impl<T> DerefMut for LoanedMessage<'_, T>
3737
where
3838
T: RmwMessage,
3939
{
@@ -43,7 +43,7 @@ where
4343
}
4444
}
4545

46-
impl<'a, T> Drop for LoanedMessage<'a, T>
46+
impl<T> Drop for LoanedMessage<'_, T>
4747
where
4848
T: RmwMessage,
4949
{
@@ -66,11 +66,11 @@ where
6666

6767
// SAFETY: The functions accessing this type, including drop(), shouldn't care about the thread
6868
// they are running in. Therefore, this type can be safely sent to another thread.
69-
unsafe impl<'a, T> Send for LoanedMessage<'a, T> where T: RmwMessage {}
69+
unsafe impl<T> Send for LoanedMessage<'_, T> where T: RmwMessage {}
7070
// SAFETY: There is no interior mutability in this type. All mutation happens through &mut references.
71-
unsafe impl<'a, T> Sync for LoanedMessage<'a, T> where T: RmwMessage {}
71+
unsafe impl<T> Sync for LoanedMessage<'_, T> where T: RmwMessage {}
7272

73-
impl<'a, T> LoanedMessage<'a, T>
73+
impl<T> LoanedMessage<'_, T>
7474
where
7575
T: RmwMessage,
7676
{

rclrs/src/subscription/readonly_loaned_message.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ where
2222
pub(super) subscription: &'a Subscription<T>,
2323
}
2424

25-
impl<'a, T> Deref for ReadOnlyLoanedMessage<'a, T>
25+
impl<T> Deref for ReadOnlyLoanedMessage<'_, T>
2626
where
2727
T: Message,
2828
{
@@ -32,7 +32,7 @@ where
3232
}
3333
}
3434

35-
impl<'a, T> Drop for ReadOnlyLoanedMessage<'a, T>
35+
impl<T> Drop for ReadOnlyLoanedMessage<'_, T>
3636
where
3737
T: Message,
3838
{
@@ -50,9 +50,9 @@ where
5050

5151
// SAFETY: The functions accessing this type, including drop(), shouldn't care about the thread
5252
// they are running in. Therefore, this type can be safely sent to another thread.
53-
unsafe impl<'a, T> Send for ReadOnlyLoanedMessage<'a, T> where T: Message {}
53+
unsafe impl<T> Send for ReadOnlyLoanedMessage<'_, T> where T: Message {}
5454
// SAFETY: This type has no interior mutability, in fact it has no mutability at all.
55-
unsafe impl<'a, T> Sync for ReadOnlyLoanedMessage<'a, T> where T: Message {}
55+
unsafe impl<T> Sync for ReadOnlyLoanedMessage<'_, T> where T: Message {}
5656

5757
#[cfg(test)]
5858
mod tests {

rosidl_runtime_rs/src/string/serde.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::{
1313
struct StringVisitor;
1414
struct WStringVisitor;
1515

16-
impl<'de> Visitor<'de> for StringVisitor {
16+
impl Visitor<'_> for StringVisitor {
1717
type Value = String;
1818

1919
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

rosidl_runtime_rs/src/traits.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ pub trait RmwMessage: Clone + Debug + Default + Send + Sync + Message {
124124
///
125125
/// Memory ownership by C is achieved by calling `init()` when any string or sequence is created,
126126
/// as well as in the `Default` impl for messages.
127+
///
127128
/// User code can still create messages explicitly, which will not call `init()`, but this is not a
128-
/// problem, since nothing is allocated this way.
129+
/// problem, since nothing is allocated this way.
130+
///
129131
/// The `Drop` impl for any sequence or string will call `fini()`.
130-
131132
pub trait Message: Clone + Debug + Default + 'static + Send + Sync {
132133
/// The corresponding RMW-native message type.
133134
type RmwMsg: RmwMessage;

0 commit comments

Comments
 (0)