Skip to content

Commit

Permalink
ethtool: clippy lints + license header
Browse files Browse the repository at this point in the history
Reviewed By: boyuni

Differential Revision: D59021484

fbshipit-source-id: c2b7f090a186c229b98fe3e47fa4864e12e6f4ee
  • Loading branch information
brianc118 authored and facebook-github-bot committed Jul 3, 2024
1 parent 2860537 commit d6815ef
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 1 deletion.
14 changes: 14 additions & 0 deletions below/ethtool/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::alloc;

use nix::errno::Errno;
Expand Down
14 changes: 14 additions & 0 deletions below/ethtool/src/ethtool_sys.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* automatically generated by rust-bindgen 0.68.1 */
#![allow(dead_code, unused_variables)]

Expand Down
21 changes: 21 additions & 0 deletions below/ethtool/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![deny(clippy::all)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
Expand Down Expand Up @@ -90,6 +105,12 @@ fn translate_stats(stats: Vec<(String, u64)>) -> Result<NicStats> {

pub struct EthtoolReader;

impl Default for EthtoolReader {
fn default() -> Self {
Self::new()
}
}

impl EthtoolReader {
pub fn new() -> Self {
Self {}
Expand Down
14 changes: 14 additions & 0 deletions below/ethtool/src/reader.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::alloc;
use std::ffi::CStr;
use std::mem;
Expand Down
16 changes: 15 additions & 1 deletion below/ethtool/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::*;

struct FakeEthtool;
Expand Down Expand Up @@ -72,7 +86,7 @@ fn test_read_stats() {
assert_eq!(stats.tx_timeout, Some(10));
assert!(!stats.raw_stats.is_empty());

let queue_stats = stats.queue.get(0);
let queue_stats = stats.queue.first();
assert!(queue_stats.is_some());

let qstats = queue_stats.unwrap();
Expand Down
14 changes: 14 additions & 0 deletions below/ethtool/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::BTreeMap;

use serde::Deserialize;
Expand Down

0 comments on commit d6815ef

Please sign in to comment.