White-Oak / qml-rust

QML (Qt Quick) bindings for Rust language
MIT License
205 stars 18 forks source link

Consider disabling warnings in macros #6

Closed nbigaouette closed 7 years ago

nbigaouette commented 7 years ago

The Q_OBJECT!() macro generates a lot of warning. Could those be suppressed so end-user is not flooded with those?

For example:

<qml macros>:5:28: 10:48 warning: method is never used: `hostname_changed`, #[warn(dead_code)] on by default
<qml macros>:5 # [ allow ( unused_mut ) ] pub fn $ signalname (
                                          ^
<qml macros>:19:1: 21:31 note: in this expansion of __gen_signals! (defined in <qml macros>)
src/connection.rs:29:1: 57:4 note: in this expansion of Q_OBJECT! (defined in <qml macros>)
<qml macros>:5:28: 10:48 warning: method is never used: `value_changed`, #[warn(dead_code)] on by default
<qml macros>:5 # [ allow ( unused_mut ) ] pub fn $ signalname (
                                          ^
<qml macros>:10:49: 11:19 note: in this expansion of __gen_signals! (defined in <qml macros>)
<qml macros>:19:1: 21:31 note: in this expansion of __gen_signals! (defined in <qml macros>)
src/connection.rs:29:1: 57:4 note: in this expansion of Q_OBJECT! (defined in <qml macros>)
White-Oak commented 7 years ago

I've mentioned this incorrectly in the commit https://github.com/White-Oak/qml-rust/commit/447ca67ea02ec881b5e137ef341351c74dfdbc8f, these warnings are supposed to be fixed, but there may appear other inconvinient warnings.

Sorry for the inconvenience -- the Q_OBJECT! nacro generates quite a bunch of a code, so it may be hard to catch every possible warning.

Btw, I'm sorry if macros are not very comfortable to use -- current rust's macros are really limiting in theirs design. When macros 1.1 will be available, Q_OBJECT and other macros are going to be redesigned to be more flexible and powerful (for example setting signals, properties and slots in custom orders, setting different options for properties (being read-only and others) etc).