Skip to content

Commit

Permalink
Fix a bunch of clippy nits
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmooney committed Apr 21, 2022
1 parent 58eaa6c commit 5e92bd1
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 20 deletions.
2 changes: 0 additions & 2 deletions common-build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");

Expand Down
2 changes: 1 addition & 1 deletion dtrace-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ impl TryFrom<&Pair<'_, Rule>> for File {
type Error = DTraceError;

fn try_from(pair: &Pair<'_, Rule>) -> Result<Self, Self::Error> {
expect_token(&pair, Rule::FILE)?;
expect_token(pair, Rule::FILE)?;
let mut providers = Vec::new();
let mut names = HashSet::new();
for item in pair.clone().into_inner() {
Expand Down
1 change: 0 additions & 1 deletion probe-test-build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use usdt::Builder;
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand Down
6 changes: 3 additions & 3 deletions tests/argument-types/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn main() {
refs::array!(|| &arr);

// Tuples may be passed in by value.
refs::tuple!(|| ((0, &x[..])));
refs::tuple!(|| (0, &x[..]));

// Serializable types may be passed by value or reference, to a probe expecting either a value
// or a reference. Note, however, that the normal lifetime rules apply: you can't return a
Expand All @@ -114,9 +114,9 @@ fn main() {
// refs::serializable_as_reference!(|| &crate::Arg::default());
// ```
let arg = crate::Arg::default();
refs::serializable_as_value!(|| crate::Arg::default());
refs::serializable_as_value!(crate::Arg::default);
refs::serializable_as_value!(|| &arg);
refs::serializable_as_reference!(|| crate::Arg::default());
refs::serializable_as_reference!(crate::Arg::default);
refs::serializable_as_reference!(|| &arg);

// It's also possible to capture and return local variables by value in the probe argument
Expand Down
1 change: 0 additions & 1 deletion tests/does-it-work/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use usdt::Builder;
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand Down
1 change: 0 additions & 1 deletion tests/empty/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use usdt::Builder;
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand Down
1 change: 0 additions & 1 deletion tests/fake-lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use usdt::Builder;
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand Down
1 change: 0 additions & 1 deletion tests/rename-builder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use usdt::Builder;
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand Down
1 change: 0 additions & 1 deletion tests/zero-arg-probe/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use usdt::Builder;
use version_check;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand Down
4 changes: 2 additions & 2 deletions usdt-attr-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ fn parse_probe_argument(
}
Ok((None, data_type_from_path(&path.path, true)))
} else {
return Err(syn::Error::new(
Err(syn::Error::new(
item.span(),
"Only pointers to path types are supported",
));
))
}
}
syn::Type::Reference(ref reference) => {
Expand Down
2 changes: 1 addition & 1 deletion usdt-impl/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub fn generate_type_check(
})
.collect::<Vec<_>>();

let preamble = unpack_argument_lambda(&types, /* clone = */ true);
let preamble = unpack_argument_lambda(types, /* clone = */ true);

let type_check_function =
format_ident!("__usdt_private_{}_{}_type_check", provider_name, probe_name);
Expand Down
2 changes: 1 addition & 1 deletion usdt-impl/src/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn compile_provider(provider: &Provider, config: &crate::CompileProvidersConfig)
let probe_impls = provider
.probes
.iter()
.map(|probe| compile_probe(&provider, probe, config))
.map(|probe| compile_probe(provider, probe, config))
.collect::<Vec<_>>();
let module = config.module_ident();
quote! {
Expand Down
4 changes: 2 additions & 2 deletions usdt-impl/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn process_section(mut data: &[u8]) -> Result<Section, crate::Error> {
let mut len_bytes = data;
let len = len_bytes.read_u32::<NativeEndian>()? as usize;
let (rec, rest) = data.split_at(len);
process_probe_record(&mut providers, &rec)?;
process_probe_record(&mut providers, rec)?;
data = rest;
}

Expand Down Expand Up @@ -174,7 +174,7 @@ fn process_probe_record(
let probe = provider.probes.entry(probename.clone()).or_insert(Probe {
name: probename,
function: funcname,
address: address,
address,
offsets: vec![],
enabled_offsets: vec![],
arguments: vec![],
Expand Down
3 changes: 1 addition & 2 deletions usdt-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ pub fn dtrace_provider(item: proc_macro::TokenStream) -> proc_macro::TokenStream
Err(e) => {
let message = format!(
"Error building provider definition in \"{}\"\n\n{}",
filename,
e.to_string()
filename, e
);
let out = quote! {
compile_error!(#message);
Expand Down

0 comments on commit 5e92bd1

Please sign in to comment.